Date: Tue, 25 Aug 2009 08:54:38 -0700
Reply-To: webonomic <webonomic@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: webonomic <webonomic@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Proc Freq show values not listed?
Content-Type: text/plain; charset=ISO-8859-1
On Aug 24, 11:38 am, webonomic <webono...@gmail.com> wrote:
> I am doing some Proc Freqs on a variable which can have the following
> possible values: 0, 1, 2, 3, 4, or 5.
>
> Here is a test program:
>
> data test;
> input var1;
> datalines;
> 0
> 0
> 1
> 1
> 1
> 3
> 3
> 3
> 3
> 3
> 5
> ;
> run;
>
> proc format;
> value var1_fmt
> 0="N/A"
> 1="Very Poor"
> 2="Poor"
> 3="Average"
> 4="Good"
> 5="Very Good"
> ;
> run;
> quit;
>
> proc freq data=test;
> tables var1;
> format var1 var1_fmt.;
> run;
>
> -----
> Resulting output:
>
> var1 Frequency Percent
> N/A 2 18.18
> Very Poor 3 27.27
> Average 5 45.45
> Very Good 1 9.09
>
> ------
I thought I'd post a followup to this question. I came across a SAS
knowledge base article that shows how to solve this same problem using
Proc Tabulate.
http://support.sas.com/techsup/technote/ts278.html
It also works quite well.
Jared
> Is there a way to make the resulting proc freq output show all of the
> values listed in the proc format? I.e. I would like the output to
> look something like this:
>
> var1 Frequency Percent
> N/A 2 18.18
> Very Poor 3 27.27
> Poor 0 0
> Average 5 45.45
> Good 0 0
> Very Good 1 9.09
>
> The only thing I can think of is to output the proc freq to a dataset,
> add the "missing" values for var1, and do a proc print.
|