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.
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.