Dear All,
I have a few values in a variable A of a dataset as follows:
A
Superb xyz
XYZ super
good xyz
good XyZ girl
I would like to find the term xyz whether upcase or lowcase or propcase and replace with some term (example: pqr) in the whole dataset. How can i do that ??
In simple words i would like to replace xyz with pqr.
Any help ?
Try this
data have;
input A $ 1 - 20;
datalines;
Superb xyz
XYZ super
good xyz
good XyZ girl
;
data want;
set have;
A = tranwrd(upcase(A), 'XYZ', 'pqr');
run;
Try this
data have;
input A $ 1 - 20;
datalines;
Superb xyz
XYZ super
good xyz
good XyZ girl
;
data want;
set have;
A = tranwrd(upcase(A), 'XYZ', 'pqr');
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.