I'm trying to get a subset dataset which contains variables uns_n and sns_n ne '.' and uns_n and sns_n ne 0 and drug = 'abc'.
Here's the code I had:
data ABgn;
set ABgn_Miss (where=(drug='abc') and uns_n ne . & uns_n ne 0 & sns_n ne . & sns_n ne 0 );
run;
I also tried different ways but I'm not getting the right data set needed.
I'm wondering what is the best way to do it.
Thank you
A useful shortcut:
set ABgn_Miss (where=(drug='abc' and uns_n and sns_n));
Numeric values of missing and zero are considered to be false while all other values are considered to be true.
Try this - it looks like your brackets aren't quite right.
data ABgn;
set ABgn_Miss (where=(drug='abc' and uns_n not in (.,0) and sns_n not in (.,0));
run;
A useful shortcut:
set ABgn_Miss (where=(drug='abc' and uns_n and sns_n));
Numeric values of missing and zero are considered to be false while all other values are considered to be true.
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.