Hi I have a variable in a dataset and want to check if a word sounds like
I used the following and did not work for me..
Could you please correct??
Thanks
data want;
set have;
if description like "myocar" then flg=1;
run;
Statring with "myocar" and Sounds like it are completely different concept, considering the scenario like this:
mmyocar vs myocar, NOT Starting, but very much Sound like;
while: myocarapdofhaposdjf vs myocar, nah.
data test;
a='myocaringhongtingdon';
output;
a='mmyocar';
output;
run;
data _null_;
set test;
if soundex(a)=soundex('myocar') then put a "Sound like";
else put a "NOT sound like";
run;
You need to be clear on what you are really after, then choose the right tools. Soundex works based on English pronunciation, if it does not meet your need, look for other options like spedis, complev, compare, compged.
Proc SQL =* operator.
Proc sql;
create table want as
select *, case when description =* "myocar" then 1 else 0 end as flg
from have;
quit;
Haikuo
Hi Thanks. Is there any Datastep option to do the same??
Thanks
Sure, if you insist:
data want;
set have;
if soundex(description)=soundex('myocar') then flg=1;
run;
Haikuo
Hi ,
I still keep getting all missing values in the flg variable even though there are words starting with myocar
Where could i have gone wrong???
Statring with "myocar" and Sounds like it are completely different concept, considering the scenario like this:
mmyocar vs myocar, NOT Starting, but very much Sound like;
while: myocarapdofhaposdjf vs myocar, nah.
data test;
a='myocaringhongtingdon';
output;
a='mmyocar';
output;
run;
data _null_;
set test;
if soundex(a)=soundex('myocar') then put a "Sound like";
else put a "NOT sound like";
run;
You need to be clear on what you are really after, then choose the right tools. Soundex works based on English pronunciation, if it does not meet your need, look for other options like spedis, complev, compare, compged.
Thanks for the detailed explanation. I appreciate your help.
Thanks...
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.