/*** TIP00375 ***/
Subject: Repeating consonants and vowels

I need to drop repeating consonants(except the first occurance) 
and all Vowels(if it is not the first letter of the name) in the 
first_name variable I havein a SAS dataset for a project which 
involves standardizing names.

How can I do this in SAS?

For example;
first_name    resulting_var
Jeffery          Jfry
Williams         Wlms
Atkinson         Atknsn
Abraham          Abrhm
Briggs           Brgs

Solution # 1: Puddin' Man Email: pudding_man@LYCOS.COM If you want 'Mortimer' to become 'Mrt' just add chars(rank(lowcase(c1))) =1; after the array declaration. data _null_; input first_name :&$24. @1 c1 $1. rest :&$24.; rest = compress(rest, 'aeiou'); array chars(0:255); do i = 1 to length(rest); if chars(rank(substr(rest, i, 1))) then substr(rest, i, 1) = '00'x; else chars(rank(substr(rest, i, 1))) =1; end; resulting_var = c1 || compress(rest, '00'x); put first_name= resulting_var=; cards; Jeffery Williams Atkinson Abraham Briggs Mortimer Tsdfsdfsdf Mary Sue Produces: first_name=Jeffery resulting_var=Jfry first_name=Williams resulting_var=Wlms first_name=Atkinson resulting_var=Atkns first_name=Abraham resulting_var=Abrhm first_name=Briggs resulting_var=Brgs first_name=Mortimer resulting_var=Mrtm first_name=Tsdfsdfsdf resulting_var=Tsdf first_name=Mary Sue resulting_var=Mry S
Solution #2: Thomasset Pierre Email: pierre.thomasset@EURONET.BE Do you know the 'soundex' routine ? It 'sounds' like what you ask for. data ; length x $24 prev $1 curr $1 ; infile cards ; input x :&$24. ; prev= x ; do i= 2 to length (x) ; curr= substr (x, i) ; if curr = prev then substr (x, i, 1)= 'a' ; prev= curr ; end ; y= compress (x, 'aeiou') ; z= soundex (x) ; put x= y= z= ; cards ; Using Same data as in Solution #1 Produces: x=Jefaery y=Jfry z=J16 x=Wilaiams y=Wlms z=W452 x=Atkinson y=Atknsn z=A32525 x=Abraham y=Abrhm z=A165 x=Brigas y=Brgs z=B622 x=Mortimer y=Mrtmr z=M6356 x=Tsdfsdfsdf y=Tsdfsdfsdf z=T231231231 x=Mary Sue y=Mry S z=M62
/*** end of tip 00375 ***/