Hi everyone,
im a beginner and i try to substr some adresses.
Result should be cutted aber 6 digits after the comma.
input
Musterstr. 1b, 12345 Musterstadt
output:
Musterstr. 1b, 12345
i tried
substr (t1.adress, findc (t1.adress,",")-0)
any ideas how to solve to start the substr 6 digits after the comma?
thanks for your help.
Try this
data test;
str = 'Musterstr. 1b, 12345 Musterstadt';
new = substr(str, 1, find(str, ',') + 6);
run;
Try this
data test;
str = 'Musterstr. 1b, 12345 Musterstadt';
new = substr(str, 1, find(str, ',') + 6);
run;
thanks a lot. it is working.
Anytime 🙂
Also, a PRXCHANGE Approach.
hope this helps 🙂
data test;
str = 'Musterstr. 1b, 12345 Musterstadt';
new = prxchange('s/(.*,.{6})(.*)/$1/', -1, str);
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 save with the early bird rate—just $795!
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.