Have_Var | Want_Var |
---|---|
123q987 | ###$### |
324s784 | ###$### |
386 | ### |
58881 | ##### |
afgelk | $$$$$$ |
Hi,
I want to translate 0-9 character # and A-Z to $
Thanks in advance!!!!
data have;
input x $20.;
cards;
123q987
;
run;
data want;
set have;
t=prxchange('s/\d/#/',-1,x);
y=prxchange('s/[a-z]/$/i',-1,t);
drop t;
run;
Look at the TRANSLATE function
Or the TRANSWRD
data have;
input x $20.;
cards;
123q987
;
run;
data want;
set have;
t=prxchange('s/\d/#/',-1,x);
y=prxchange('s/[a-z]/$/i',-1,t);
drop t;
run;
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.