Hello ,
Please help to change "MCLAUREN" value as "McLAUREN" by using Perl Expression (PRXCHANGE)
I tried below code but didn't work for me
data _null_;
x = 'MCLAUREN';
y = prxchange("s/ (MC) /\u\L$1/i", -1, x);
put y=;
run;
Thanks in Advance
Look at the example on Page 9 of this:
http://www2.sas.com/proceedings/forum2007/223-2007.pdf
I think you want to set your regular expression first like
re = prxparse('s/ (MC) /\u\L$1/i');
and then call it like they do
cleanname= prxchange( re, 1, oldname);
Look at the example on Page 9 of this:
http://www2.sas.com/proceedings/forum2007/223-2007.pdf
I think you want to set your regular expression first like
re = prxparse('s/ (MC) /\u\L$1/i');
and then call it like they do
cleanname= prxchange( re, 1, oldname);
something like this
data _null_;
x = 'MCLAUREN';
y = prxchange("s/^(MC)(.+)/Mc$2/i", -1, x);
put y=;
run;
Or like this:
data _null_;
x = 'pEter MClAUREN & ian macIllIoMChadha';
y = prxchange("s/\b(MC|MAC)(\w)/\1\u\2/i", -1, propcase(x));
put y=;
run;
Result:
y=Peter McLauren & Ian MacIlliomchadha
data _null_;
x = 'MCLAUREN';
y = prxchange("s/^(MC)/\u\L$1/i", 1, x);
put y=;
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: