Hi,
I was wondering whether there is an easy way to assess the no. missing/null values in a field?
I use the following for numeric and string variables. Its fine for numeric variables, but the code for string variables returns a frequency table of values, if there is a lot of records and a string ID field the output can be massive. Is there a way to output a report of only the count of the number of missing values for each character variable?
thanks,
/* Asess numeric variables */
proc means data = Datafile n nmiss;
var _numeric_;
run;
/* Asess categorical variables */
proc freq data = Datafile;
tables _character_ ;
... just in case anyone was wondering!
proc format;
value $miss " "="missing"
other="nomissing";
run;
proc freq data=datafile;
tables _character_ / missing;
format _character_ $miss.;
run;
... just in case anyone was wondering!
proc format;
value $miss " "="missing"
other="nomissing";
run;
proc freq data=datafile;
tables _character_ / missing;
format _character_ $miss.;
run;
data have; set sashelp.class; if ranuni(-1) lt 0.5 then call missing(name); if ranuni(-1) lt 0.5 then call missing(age); run; proc sql; select cats('nmiss(',name,') as nmiss_',name) into : list separated by ',' from dictionary.columns where libname='WORK' and memname='HAVE'; create table want as select &list from have; quit;
Ksharp
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.