BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mayasak
Quartz | Level 8

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

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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.

View solution in original post

3 REPLIES 3
SASKiwi
PROC Star

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;
Astounding
PROC Star

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.

mayasak
Quartz | Level 8
Thank you. That was helpful

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1008 views
  • 3 likes
  • 3 in conversation