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 (November 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 20 Nov 2006 21:07:47 -0500
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: % missing within each variable

On Mon, 20 Nov 2006 11:07:30 -0800, Terjeson, Mark <Mterjeson@RUSSELL.COM> wrote:

>Hi Firepit, > >Here are a couple ways with and without SQL. > >Typically, in SAS, with SQL, you can get >grand totals by not having a GROUP BY, and >you can get subtotals with a GROUP BY. >Here is also a clever example of SQL when >conditions are just right you can do BOTH >grand totals and substotals by group in the >same query without subqueries. >A not-so-typical trick. > >The following two methods yield the same >results. > > > > > * make sample data ; >data class_with_missings; > set sashelp.class; > if age eq 13 then age = .; >run; > > > * example#1 PROC FREQ ; >proc freq data=class_with_missings noprint; > table age / list missing out=result1(where=(age eq .)); >run; > > > * example#2 PROC SQL ; >proc sql; > create table result2 as > select distinct age, > count(*)-(case when age eq . then > count(age) end) as count, > (count(*)-(case when age eq . then > count(age) end))/count(*)*100 as percent > from class_with_missings > having age eq . > ; >quit;

Or just

select nmiss(age) as count, nmiss(age)/count(*)*100 as percent from class_with_missings ;

> > > > >Hope this is helpful. > > >Mark Terjeson >Senior Programmer Analyst, IM&R >Russell Investment Group > > >Russell >Global Leaders in Multi-Manager Investing > > > > > > >-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >firepit >Sent: Monday, November 20, 2006 10:44 AM >To: SAS-L@LISTSERV.UGA.EDU >Subject: % missing within each variable > >One more - is there an easy way in SAS find the % missing within each >group? > >As in my example below with variables name, score and date, can I find >the % missing (.) scores by name? >I've been looking into proc sql > >proc sql; > > >Thanks much!!


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