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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.