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...
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.