Date: Mon, 21 Mar 2005 09:42:22 -0800
Reply-To: Dennis Diskin <diskin@SNET.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dennis Diskin <diskin@SNET.NET>
Subject: Re: Fun with PROC FREQ
Content-Type: text/plain; charset=us-ascii
Unless you need something else from FREQ, try Proc
SUMMARY. The below will give you one record with the
counts non-missing for each variable in the list. You
can easily calculate the percentage.
proc summary data=afile N;
output out=b(where=(_stat_ eq 'N'));
var a b c d e;
array vars (*) a b c d e;
array pct (*) pa pb pc pd pe;
do _i = 1 to dim (vars);
pct(_i) = var(i) * 100 / nobs;
set a nobs=nobs;
If you insist on Proc FREQ, you can first create a
format for non-missing and feq using that create on
value nm .=' ' other='N';
proc freq data=a;
table a / missing out=aa(where = (a ne .));
format a nm.;
This technique requires a separate table statement
(and output dataset) for each variable. I believe that
you can simplify this using the ODS select statement.
--- Daniel Reyes <junkdalejreyes@YAHOO.COM> wrote:
> I have a dataset in which I want to the frequency
> count and percentage of Variable X is NOT blank.
> There are about 35 variables to test, but if I know
> how to do one, then I figure I can do the rest.
> For example,
> The file is called AFILE. There are 100 records.
> Variable X is DESC.
> Ideally, it would look something like this:
> TOTAL = 100
> DESC = 98 recs, 98%
> I am HORRIBLE at PROC FREQ. Does anyone know of
> third-party reference sources that break down the
> and outs of PROC FREQ?
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!