Sample 24582: Combine data sets based upon similar values
Encode character strings using SOUNDEX to aid in combining the data based upon similar but not exact values.
Note:
The SOUNDEX algorithm is English-biased. For more details about SOUNDEX, please refer to the SAS Language Reference, Dictionary under Functions.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
data a;
input fname $20.;
var1=soundex(scan(fname,1,' '));
var2=soundex(scan(fname,-1,' '));
datalines;
john smith
jon smithe
jonn smythe
john paul
;
proc sort data=a;
by var1 var2;
run;
data b;
input name $20.;
var1=soundex(scan(name,1,' '));
var2=soundex(scan(name,2,' '));
datalines;
John Smith
;
data c;
merge a b;
by var1 var2;
run;
proc print;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Obs fname var1 var2 name
1 john paul J5 P4
2 john smith J5 S53 John Smith
3 jon smithe J5 S53 John Smith
4 jonn smythe J5 S53 John Smith
Encode character strings using SOUNDEX to aid
in combining the data based upon similar but
not exact values.
Type: | Sample |
Topic: | SAS Reference ==> Functions ==> Character SAS Reference ==> Statements ==> File-handling ==> MERGE SAS Reference ==> DATA Step SAS Reference ==> Functions ==> Character ==> SOUNDEX Common Programming Tasks ==> Combining Data SAS Reference ==> Statements ==> File-handling ==> MERGE ==> with BY Common Programming Tasks ==> Working with Character Data
|
Date Modified: | 2008-01-28 11:00:41 |
Date Created: | 2004-09-30 14:08:55 |
Operating System and Release Information
SAS System | Base SAS | All | n/a | n/a |