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

Hello! If I have a numeric variable (call it X) with a bunch of missing values in the dataset, what SAS command do I use to pull up only the observations with missing values? Is it the nmiss function? If so, how do I structure my command? Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Use the MISSING() function, since it works the same on character and numeric variables.
This would return all records missing x.

data want;
set have;
if missing(x);
run;

View solution in original post

3 REPLIES 3
Astounding
PROC Star

The WHERE statement can subset:

 

where var > . ;

 

It can be used in either a DATA step or a procedure.

 

Technically, if you have special missing values in your data, you would use:

 

where var > .Z ;

 

It sounds like that would not be an issue for you and you would be safe with the first statement.

Reeza
Super User
Use the MISSING() function, since it works the same on character and numeric variables.
This would return all records missing x.

data want;
set have;
if missing(x);
run;
novinosrin
Tourmaline | Level 20

@learn2 wrote:

Hello! If I have a numeric variable (call it X) with a bunch of missing values in the dataset, what SAS command do I use to pull up only the observations with missing values? Is it the nmiss function? If so, how do I structure my command? Thanks!

 


 

Sounds like you need missing function 

 

where x=.;

/*or*/

where missing(x);

/*or*/

where x is missing;

/*or*/

where x is null;

 

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1076 views
  • 0 likes
  • 4 in conversation