I need help to get my desire output through the sas coding.
I am using sas eg 8.1.
I have one data with column name "Name" and i want to found sound like name in same variable.
Data Have;
Name
mrityunjaya
gaurav
deepak
mrtunjay
dipak
piyush
mrityunjaya;
And i want output like this.(generate new column with "match" "non match" value)
Data want;
Name Flag
mrityunjaya match
gaurav not-match
deepak match
mrtunjay match
dipak match
piyush not-match
mrityunjaya match
can some please help me how can i do this in sas.
Functions like spedis, compged and/or complev should help you to identify matches. The following step should get you started:
data have;
length name $ 20;
input name;
datalines;
mrityunjaya
gaurav
deepak
mrtunjay
dipak
piyush
mrityunjaya
;
data scores;
set have;
do i = _n_+1 to numObs;
set have(rename=(name=cmp)) nobs=numObs point=i;
score_spedis = spedis(name, cmp);
score_compged = compged(name, cmp);
score_complev = complev(name, cmp);
output;
end;
run
@AnandsinhSindha wrote:
get some score based on above code but i am not getting my desired output....
Of course not, i wrote: "The following step should get you started", meaning that it is up you to decide which function to use and which score is low enough to indicate a match.
The answer to your question is:
proc sql;
select unique a.NAME, max(a.NAME =* b.NAME) as FLAG
from TABLE a
cross join
TABLE b
group by 1;
But a cross join gets really expensive really quickly when the volume of data increases.
10,000 records yield 100 million matches.
There are better ways, and this is typically an iterative process. For example you can remove the exact matches first to reduce the volume. Or you can try matching the first letter before using the sound like operator.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.