- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Do you guys know how to replace remove the comma and period in something like this:
Removed
I had to concatenate to get list of claim numbers (with leading zeros). Now, I have that string but I want to delete all the stuff at the end. I tried this but it didn't work
Removed
By the way, I am using SAS and regex, something like prxchange.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How did you make the string to begin with? Why not just fix that step instead?
You can use the FINDC() command to find the last character before the trailing commas and periods start.
data test;
infile cards dsd truncover;
input @1 have $100. @1 (id1-id20) (:$30.);
want=catx(',', of id1-id20);
loc=findc(have,' ,.',-1000,'k');
want2=substrn(have,1,loc);
put (_all_) (=/);
cards;
18430109646000104331929350001,064380958490001,974317618110001,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.
;
have=18430109646000104331929350001,064380958490001,974317618110001,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,. id1=18430109646000104331929350001 id2=064380958490001 id3=974317618110001 id4= id5= id6= id7= id8= id9= id10= id11= id12= id13= id14= id15= id16= id17= id18= id19= id20= want=18430109646000104331929350001,064380958490001,974317618110001 loc=61 want2=18430109646000104331929350001,064380958490001,974317618110001
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@user112a2 wrote:
Do you guys know how to replace remove the comma and period in something like this:
'18430109646000104331929350001,064380958490001,974317618110001,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,. '
I had to concatenate to get list of claim numbers (with leading zeros). Now, I have that string but I want to delete all the stuff at the end. I tried this but it didn't work
data OUT.REQ_1_4_25 ; set OUT.REQ_1_4_24; CONCAT1=PRXCHANGE('s/,.//',1,CONCAT); run;
By the way, I am using SAS and regex, something like prxchange.
And another reason why I ask every time someone does this "Why?". I have a very hard time understanding what is improved by this time of variable creation unless it is the very last step prior to printing for human readability.