Hi,
I am trying to convert numeric to character value for one of the variables, but the missing values are taking the values.
Can some one suggest a way that the missing values are displayed as missing value or correct me what I am missing in the code?
Thanks in advance.
Regards,
Nasya
*------------------------------------------------------------------------------*;
* Screener data set
*------------------------------------------------------------------------------*;
data screener (keep=subject age misd dispos);
set pdata.screener;
by subject;
run;
/*Sort the data*/
proc sort data= screener;
by subject;
run;
data screenerfinal;
set screener;
attrib TEST length=$200; /*Convert numeric to character and new variable is assigned*/
if dispos eq 6 then delete;/*Did not qualify*/
misd_=put(misd, best.);
if misd le 5 then TEST = ' Normal Level';
else if misd > 5 then TEST = ' Low Level';
else if misd eq . then TEST= ' ';
keep subject age misd test dispos;
run;
proc sort data= screenerfinal;
by subject;
run;
First you create a dataset with "by subject", which only works if the source is already sorted by subject, so the following sort serves no purpose.
Then you create character variable misd_, but never use it, and discard it immediately.
Have you inspected misd for its values?
Please post some example data for dataset screener, and tell us what you expect as a result for each observation. Use a data step with datalines to post example data in a usable way.
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.