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;
Use the 'M' Modifier and you're good 🙂
Should have looked better 🙂
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000214639.htm
Use the 'M' Modifier and you're good 🙂
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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.