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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 522 views
  • 0 likes
  • 2 in conversation