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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.