I have text:
[{crmId: 270294251239318446711736, zapłacone faktury:0}, {crmId: 109338771587264730348439, zapłacone faktury:0}, {crmId: 105563037561893625234667, zapłacone faktury:0}, {crmId: 529342335726661326310295, zapłacone faktury:0}, {crmId: 102928808219759468645267, zapłacone faktury:0}, {crmId: 446627936599178084266781, zapłacone faktury:0}, {crmId: 1206246190076409102049055, zapłacone faktury:0}, {crmId: 1208925742523269613394857, zapłacone faktury:0}]
I want crmid:
270294251239318446711736
109338771587264730348439
105563037561893625234667
529342335726661326310295
102928808219759468645267
446627936599178084266781
1206246190076409102049055
1208925742523269613394857
In this case is 7 id in new row but their number and length may vary
data have;
have="[{crmId: 270294251239318446711736, zapłacone faktury:0}, {crmId: 109338771587264730348439, zapłacone faktury:0}, {crmId: 105563037561893625234667, zapłacone faktury:0}, {crmId: 529342335726661326310295, zapłacone faktury:0}, {crmId: 102928808219759468645267, zapłacone faktury:0}, {crmId: 446627936599178084266781, zapłacone faktury:0}, {crmId: 1206246190076409102049055, zapłacone faktury:0}, {crmId: 1208925742523269613394857, zapłacone faktury:0}]";
run;
data want;
set have;
pid=prxparse('/(?<=crmId:)\s*\d+/i');
s=1;e=length(have);
call prxnext(pid,s,e,have,p,l);
do while(p>0);
crmId=substr(have,p,l);
output;
call prxnext(pid,s,e,have,p,l);
end;
keep crmId;
run;
You mean you have a text file with lines like this?
data have;
have="[{crmId: 270294251239318446711736, zapłacone faktury:0}, {crmId: 109338771587264730348439, zapłacone faktury:0}, {crmId: 105563037561893625234667, zapłacone faktury:0}, {crmId: 529342335726661326310295, zapłacone faktury:0}, {crmId: 102928808219759468645267, zapłacone faktury:0}, {crmId: 446627936599178084266781, zapłacone faktury:0}, {crmId: 1206246190076409102049055, zapłacone faktury:0}, {crmId: 1208925742523269613394857, zapłacone faktury:0}]";
run;
data want;
set have;
pid=prxparse('/(?<=crmId:)\s*\d+/i');
s=1;e=length(have);
call prxnext(pid,s,e,have,p,l);
do while(p>0);
crmId=substr(have,p,l);
output;
call prxnext(pid,s,e,have,p,l);
end;
keep crmId;
run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.