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;

 

 

 

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 save with the early bird rate—just $795!

Register now

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
  • 1177 views
  • 0 likes
  • 4 in conversation