Date: Fri, 25 Feb 2000 09:55:20 -0500
Reply-To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject: Re: report for frequency data
Content-Type: text/plain; charset="iso-8859-1"
> From: Arthur Ellen [mailto:arte@PANIX.COM]
> Is there a way to use PROC FREQ with a small
> list of alpha values to print out all the
> frequencies for each variable despite the
> fact that PROC FREQ will only produce
> an out for the last combination on the
> TABLES command. My goal is to
> produce a report using put to produce something
> like this:
>
> VARIABLE A B C
> -------------------------------------------------
> 001 3 0 0
> 002 2 2 0
> 003 1 1 1
> 004 0 2 1
> 005 0 0 3
>
> DATA ALPH_IN;
> INPUT (A1-A5) ($CHAR1.);
> CARDS;
> AAABC
> ABBBC
> ABCCC
> ;
> PROC FREQ DATA=ALPH_IN;
> TABLES A1-A5/OUT=FREQOUT;
> PROC PRINT DATA=FREQOUT;
> /* only A5 in the output file */
Oh, yeah, piece of cake!
> PROC FREQ DATA=ALPH_IN;
> TABLES A1/OUT=A1;
> TABLES A2/OUT=A2;
> TABLES A3/OUT=A3;
> TABLES A4/OUT=A4;
> TABLES A5/OUT=A5;
Then you rotate each of your five data sets with proc TRANSPOSE;
remember to use the ID variable so your new variables have as their name the
value of A?.
seems like you want to rename '_NAME_' to 'Variable', neh?
or perhaps just 'A'
proc TRANSPOSE
data = A1
out = T1(rename=(_NAME_=A));
id A1;
I don't see from your description how you relate the values of 'Variable' in
('001','002'...)
to your var list of A1-A5.
next glue all the data sets together with either a data step or proc APPEND.
hm, then there's the translation of missing to zero: so a data step:
if A = . then A = 0;
as always: hope this points you into the correct part of the RTFM
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
---> cheerful provider of UNTESTED SAS code!*! <---