Tip of the Day:September 12

From sasCommunity
Jump to: navigation, search

sasCommunity Tip of the Day

Phonetic algorithms can be useful in situation where the names are spelled differently by the same person. In this situation, it is critical that phonetic algorithms are used for de-duplication purposes. See the Wikipedia article on Soundex.

/* Example of soundex phonetic application */
 
data _null_;
 
    /* a case where the name is the same but spelt differently */
 
    name1 = "ian";
    name2 = "iain";
 
    /* a direct string comparison in this case will fail */
 
    if name1 = name2 then put "name1 = name2 is true.";
    else put "name1 = name2 is false.";
 
    /* a soundex string comparison in this case will succeed */
 
    if soundex(name1) = soundex(name2) then put "name1 = name2 is true with soundex.";
    else put "name1 = name2 is false with soundex.";
 
run;

Submitted by Murphy Choy. Contact me at my Discussion Page.



Feel free to comment on this tip.


Prior tip - Next tip - Random Tip

Submit a Tip