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
In-Reply-To: 6667
Content-Type: text/plain; charset=us-ascii
Daniel,
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;
run;
data pct;
data b;
set b;
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;
end;
output;
stop;
set a nobs=nobs;
run;
If you insist on Proc FREQ, you can first create a
format for non-missing and feq using that create on
output dataset.
proc format;
value nm .=' ' other='N';
run;
proc freq data=a;
table a / missing out=aa(where = (a ne .));
format a nm.;
run;
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.
HTH,
Dennis Diskin
--- 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.
> The
> Variable X is DESC.
>
> Ideally, it would look something like this:
>
> AFILE
> TOTAL = 100
> DESC = 98 recs, 98%
>
> I am HORRIBLE at PROC FREQ. Does anyone know of
> third-party reference sources that break down the
> ins
> and outs of PROC FREQ?
>
> Thanks,
> Dan
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
>