BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I'm a beginner in SAS, and have been exposed to SAS for less than a week only. I need helps from you guys in solving this problem, for which I have to deliver the solution by tomorrow.

I have a data set with, let say 500 variables. I need to produce a list of records of which any one of the 500 variables containing null value. How can I do this with SAS?

Your help is greatly appreciated. Many thanks in advance! Message was edited by: francis
1 REPLY 1
Olivier
Pyrite | Level 9
Hi Francis.
This is not so horrible in SAS. What you have to do with SAS is something like this :
[pre]
ODS HTML FILE="c:\temp\any null.htm" ;
PROC PRINT DATA = yourDataSet (WHERE = (NMISS(OF var1-var500)>0)) LABEL ;
RUN ;
ODS HTML CLOSE ;
[/pre]
A few words to comment the solution :
1) the ODS HTML will produce an HTML file that contains the listing. I seemed to me that the HTML (without any limitation of page width) will be the best to read a 500-variable-wide table
2) the NMISS statistical function returns the number of missing values in a set of numeric variables
3) in the NMISS function, you can specify a list of variables. There are several ways to do that :
- NMISS(var1, var2, var3) if you feel patient enough to type all the 500 variables names
- NMISS(OF _NUMERIC_) for all numeric variables in your dataset
- NMISS(OF var3-var10) for the whole "family" of variables with names such as var3, var4, var5, ..., var9, var10. Does not work if any member of the family is missing (in my example, if there is no var7 variable, it will not execute)
- NMISS(OF var:) for all variables having their names beginning with "VAR"
- NMISS(OF var40--x) for all variables physically stored between var40 on the left and x on the right, var40 and x being included in the selection
- NMISS(OF var40-NUMERIC-x) for a subset of the above selection, restricted to numeric variables only.

I hope you will have a working solution on time. Good luck and welcome to SAS !
Olivier

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 827 views
  • 0 likes
  • 2 in conversation