BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bendsteel6
Obsidian | Level 7

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jagadishkatam
Amethyst | Level 16

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;
Thanks,
Jag

View solution in original post

6 REPLIES 6
Jagadishkatam
Amethyst | Level 16

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;
Thanks,
Jag
bendsteel6
Obsidian | Level 7

Works wonderfully!  Thanks!!!

Jagadishkatam
Amethyst | Level 16
Could you please Mark answers as helpful and correct as appropriate. It helps future users narrow down what responses to look at.
Thanks,
Jag
bendsteel6
Obsidian | Level 7

I'd love to!  How do I do that?

Jagadishkatam
Amethyst | Level 16
you can see mark as answer and you need to click.
Thanks,
Jag
bendsteel6
Obsidian | Level 7


Got it, done.  Thanks.

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1673 views
  • 1 like
  • 2 in conversation