Check the missing values
21. July 2007 05:36
SAS version 9 has come up with nice useful options. For example NLEVELS options in PROC FREQ statement. This option in PROC FREQ statement is used to display the “Number of Variable Levels” . By using this options we can get the distinct count for each variable listed in the TABLES statement. If TABLES statement is omitted, by default it will display for all variables in that dataset.This little program uses NLEVELS options in order to create the table ( C ) that include variables contain missing values. It’s preferable to close output with command : ods listing close if the data contains a lot of variables . And after that to run the program. And don’t forget to open the output with command ods listing;
data a;
input x $1. y z ;
cards;
t 1 5
u . 3
. 2
;
run;
ods listing close;
ods output nlevels=b ;
proc freq data=a nlevels ;
tables _ALL_ / nofreq nopercent nocum ;
run;
ods output close;
data c(drop=NMissLevels);
set b(keep=TableVar NMissLevels where=(NMissLevels>0));
run;
ods listing

Email 