LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 3 Feb 2010 12:03:11 -0400
Reply-To:   Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Subject:   Re: Making a table of % of missing values for several variables
In-Reply-To:   <ada1d29c-1f8f-4c52-bd75-7bac1289f210@z41g2000yqz.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1

Lance,

Yet another array way:

Sample Data:

%let N = 2010; data have; array s[*] $1 SNP1 - SNP50; do id = 1 to &N; do i = 1 to 50; if ranuni(123) > .3 then s[i] = '1'; else s[i] = ' '; end; output; end; drop i; run;

Array solution:

data need; array k[50] _temporary_ ; do until(eof); set have end = eof; array s[*] $1 SNP1 - SNP50; do _n_ = 1 to dim(k); if s[_n_] ne ' ' then k[_n_] ++ 1; end; end; do i = 1 to dim(k); k[i] = (&N - k[i]) / &N * 100; Name = vname(s[i]); Missing = k[i]; output; end; keep Name Missing; run;

proc print data = need; run;

Kind regards, Muthia Kachirayan On Wed, Feb 3, 2010 at 1:10 AM, Lance Smith <medicaltrial@gmail.com> wrote:

> Hi > > I have a dataset with 50 character variables (SNP1 - SNP50), each of > which have a certain amount of missing data. I want to create a table > that will give me the percentage of missing data per variable. Maybe > something like this: > > VARIABLE N %MISSING > SNP1 2010 2.6% > . > . > . > . > . > SNP50 2010 5% > > How do I do this in SAS? > Thank you for your help. >


Back to: Top of message | Previous page | Main SAS-L page