If data contains only digits or digits with decimals then would like to create a column "want" and assign those records to the column. tried compress function but it is compressing decimals too.
Rawdata
UNKNOWN
37.5/25
37.5-25
0.25
25
10
1000IU
Rawdata want
UNKNOWN
37.5/25
0.25 0.25
25 25
10 10
1000IU
This should do it:
want = input(rawdata, ??16.);
Since you didn't specify, this approach assumes you would like the new variable to be numeric, not character.
Yes want is only Numeric an would like want_char with remaining values
If you would like to add WANT_CHAR as well, it's easy enough:
want = input(rawdata, ??16.);
if want = . then want_char = rawdata;
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.