Hi,
In the following lines, I simply need to change the '0's in the patterns (08*119*5, 05*119*5, etc.) with a capital "O" (O8*119*5, O5*119*5, etc.) . I've tried with the PRXCHANGE function but I can't seem to get it to work without changing all the other '0's in the datalines.
data test;
input COM_FIELD3 $1000.;
datalines;
CORRECTION:08*119*5 09*119*5 04*119*5 05*119*5 TECHID:1150068 REPAIR DOOR ACCESS PANEL LEFT 1.7 REPAIR DOOR ACCESS PANEL RIGHT 1.7 NON-ADJACENT OVERLAP -0.2
CORRECTION:08*119*5 09*119*5 04*119*5 05*119*5 TECHID:1150042 REPAIR DOOR ACCESS PANEL LEFT 1.7 REPAIR DOOR ACCESS PANEL RIGHT 1.7 NON-ADJACENT OVERLAP -0.2
CORRECTION:08*119*5 09*119*5 04*119*5 05*119*5 TECHID:1150068 REPAIR DOOR ACCESS PANEL LEFT 1.7 REPAIR DOOR ACCESS PANEL RIGHT 1.7 NON-ADJACENT OVERLAP -0.2
CORRECTION:08*119*5 09*119*5 04*119*5 05*119*5 TECHID:1150068 REPAIR DOOR ACCESS PANEL LEFT 1.7 REPAIR DOOR ACCESS PANEL RIGHT 1.7 NON-ADJACENT OVERLAP -0.2
;
run;
Any help would be greatly appreciated!
Thanks.
Hope this helps
please try
data test;
input COM_FIELD3& $1000.;
new=prxchange('s/(0)(\d\*)/O$2/',-1,COM_FIELD3);
datalines;
CORRECTION:08*119*5 09*119*5 04*119*5 05*119*5 TECHID:1150068 REPAIR DOOR ACCESS PANEL LEFT 1.7 REPAIR DOOR ACCESS PANEL RIGHT 1.7 NON-ADJACENT OVERLAP -0.2
;
run;
Hope this helps
please try
data test;
input COM_FIELD3& $1000.;
new=prxchange('s/(0)(\d\*)/O$2/',-1,COM_FIELD3);
datalines;
CORRECTION:08*119*5 09*119*5 04*119*5 05*119*5 TECHID:1150068 REPAIR DOOR ACCESS PANEL LEFT 1.7 REPAIR DOOR ACCESS PANEL RIGHT 1.7 NON-ADJACENT OVERLAP -0.2
;
run;
Works wonderfully! Thanks!!!
I'd love to! How do I do that?
Got it, done. Thanks.
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!
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.