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

 

I have a string WKT1 which I want to divide in several columns.

enddate should be a blank.. but it gets the value of year? From then on, every value gets the wrong content..

 

data test;
WKT1 = '"MULTIPOLYGON (((1909259740883)))";59701136;20190325101323;VMM;2019/03/25;;2027;GUP-44034-005;LOCHRISTI;Riolering;Gepland;Gemeente;;;2019/03/25;Fix;Riolering; ';
run;

data test2;
set test;
WKT = scan(WKT1,1,';');
id = scan(WKT1,2,';');
uploaddate = scan(WKT1,3,';');
source = scan(WKT1,4,';');
startdate = scan(WKT1,5,';');
enddate = scan(WKT1,6,';');
year= scan(WKT1,7,';');
sourcereference = scan(WKT1,8,';');
municipality= scan(WKT1,9,';');
activity= scan(WKT1,10,';');
status= scan(WKT1,11,';');
pilot= scan(WKT1,12,';');
sourceupload= scan(WKT1,13,';');
synductisid = scan(WKT1,14,';');
modifydate= scan(WKT1,15,';');
statussynductis= scan(WKT1,16,';');
sourceactivity= scan(WKT1,17,';');
gipodid = scan(WKT1,18,';');
run;
1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Use the 'M' Modifier and you're good 🙂

Jagadishkatam
Amethyst | Level 16

I tried to shorten the code with arrays, hope it helps

 

data test;
WKT1 = '"MULTIPOLYGON (((1909259740883)))";59701136;20190325101323;VMM;2019/03/25;;2027;GUP-44034-005;LOCHRISTI;Riolering;Gepland;Gemeente;;;2019/03/25;Fix;Riolering; ';
array vars(*) $100. WKT id uploaddate source startdate enddate year sourcereference municipality activity status pilot sourceupload synductisid modifydate statussynductis sourceactivity gipodid;
do i = 1 to dim(vars);
vars(i)=scan(WKT1,i,';','m');
end;
run;

 

 

Thanks,
Jag

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 3 replies
  • 856 views
  • 1 like
  • 3 in conversation