DATA Step, Macro, Functions and more

Urgent Req: Finding out Number of Missing values

Reply
N/A
Posts: 0

Urgent Req: Finding out Number of Missing values

Hi All,

I have a dataset with approx 40 variables which are integer as well as string datatypes. I would like to find out number of missing values and number of non missing values for each variable and output them to a output dataset.

Rather than hardcoding the variable names in proc sql i would like to automate them.

Thanks & Regards
Samuel
Super Contributor
Super Contributor
Posts: 3,174

Re: Urgent Req: Finding out Number of Missing values

Posted in reply to deleted_user
test reply - ignore.
Super Contributor
Super Contributor
Posts: 3,174

Re: Urgent Req: Finding out Number of Missing values

[Sorry - SAS website server hangs with a more detailed post]

With PROC SQL (similar to other SAS dataset option/parameter specifications), explore using the (KEEP=_NUMERIC_) parameter to select all SAS variables of a particular type.

Scott Barry
SBBWorks, Inc.
Super Contributor
Super Contributor
Posts: 3,174

Re: Urgent Req: Finding out Number of Missing values

[So I am breaking it up into two parts]

The SAS support website http://support.sas.com/ has SAS product documentation and supplemental technical papers - the site's SEARCH facility can be used or consider the Google advanced search argument below which yields matching search results on the site using your topic (note that the site parameter must be in lowercase characters or it is ignored by Google):

proc sql data set options site:sas.com

Scott Barry
SBBWorks, Inc.
Respected Advisor
Posts: 4,173

Re: Urgent Req: Finding out Number of Missing values

Posted in reply to deleted_user
Hi Samuel
That should do the job.
HTH
Patrick



data have;
infile datalines truncover;
input var1 $1-2 var2 3-4 ;
datalines;
a 1
2


e 4
;
proc sql noprint;
select 'sum(missing('||name||')) as '||name into Smiley FrustratedelList2 separated by ', '
from dictionary.columns
where libname='WORK' and memname='HAVE';

create table want as
select &SelList2
from have;
quit;

title 'N Missings per Variable';
proc print data =want noobs;
run;
Ask a Question
Discussion stats
  • 4 replies
  • 129 views
  • 0 likes
  • 3 in conversation