* The example below shows how you can alter a string in a character variable ; * It replaces , . or – with nothing ;
data temp; input com $12.; cards; ANC, Inc ANC. Inc ANC Inc ANC-Inc Anc ; run; data temp2; set temp; rx=rxparse("$',.-' to ''"); /*define pattern*/ mycom=compress(com); call rxchange(rx,999,mycom); comname=compress(mycom); drop mycom rx; run; proc print data=temp2; run;
Obs com comname
1 ANC, Inc ANCInc 2 ANC. Inc ANCInc 3 ANC Inc ANCInc 4 ANC-Inc ANCInc 5 Anc Anc