Hello,
I'd like to separate alphanumeric string into numeric and character variables like below:
Data have:
Data want - how do I get the output like this:
I really appreciate your help!
Thank you!
or
data want;
set have;
num = input(text, ?? 8.);
if missing(num) then char = text;
run;
Try this
data have;
input text $20.;
datalines;
2.2
10
15
not reported
missing
<5
12.4
;
data want;
set have;
if input(text, 8.) then num = input(text, 8.);
else char = text;
run;
or
data want;
set have;
num = input(text, ?? 8.);
if missing(num) then char = text;
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.