Date: Tue, 20 May 2008 15:00:20 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>"
<schreier.junk.mail@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>"
<schreier.junk.mail@GMAIL.COM>
Subject: Re: Is there a way in this proc? (proc freq question)
On Tue, 20 May 2008 15:15:10 -0700, Instituto GPP - Adriano Rodrigues
<adriano@GPP.COM.BR> wrote:
>Hi all,
>
>
>I have the follow:
>
>
>Data one;
>
>Set big;
>
>Proc freq;
>
>Table a1;
>
>Weight qx1;
>
>Run;
>
>
>
>Data two;
>
>Set big;
>
>Proc freq;
>
>Table a1 * sex /norow nocum nofreq nopercent;
>
>Weight qx1;
>
>Run;
>
>
>
>In this second table, using weight, is possible to have the global result
>for var a1 in last collum?
>
>
>
>Thanks,
>
>Adriano
Test data helps:
data big;
do _n_ = 1 to 10;
a1 = ceil(ranuni(123)*7);
sex = substr('MF',ceil(ranuni(123)*2),1);
qx1 = ceil(abs(3*rannor(123) ) );
output;
end;
run;
Get rid of two superfluous DATA steps and one unneeded PROC FREQ step:
Proc freq data=big;
Table a1;
Table a1 * sex /norow nocum nofreq nopercent;
Weight qx1;
Run;
PROC TABULATE provides more control than PROC FREQ and get get the one-ways
into the same table as the two-ways:
proc tabulate data=big;
class a1 sex;
freq qx1;
table a1 all, sex all;
run;