Date: Thu, 22 Feb 2001 08:51:25 -0500
Reply-To: Droogendyk Bill <bill_droogendyk@DOFASCO.CA>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Droogendyk Bill <bill_droogendyk@DOFASCO.CA>
Subject: Re: proc tabulate -row & col pct
Content-Type: text/plain
Gitte:
a snippet of code that I use to calculate row & col pcts in tabulate. The
layout is not quite as you've proposed, but I think that you will be able to
show the values that you're looking for. Try it and see.
proc tabulate data=yourdata;
class grp qual drc;
var tonnes;
KEYLABEL SUM='TONNES' PCTSUM='PCT';
format drc $qq. qual $q_cd. grp $grp.;
table (GRP=' '*(drc=' ' all) ALL),
(qual='HMCO' all)*tonnes=' '*
(sum*f=comma7.0 pctsum <qual all> ='ROW PCT' *f=4.1
pctsum<drc all*qual all>='COL PCT' *f=4.1)/
hth
W.(Bill) Droogendyk
Quality Systems
Dofasco Inc. Hamilton ON Canada
Telephone: 905 548 7200 x3359
Fax: 905 548 4007
SAS: Anything else is just a toy!
> -----Original Message-----
> From: Gitte Churlish [SMTP:gchur@HOTMAIL.COM]
> Sent: Wednesday, 21 February, 2001 18:23
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: proc tabulate
>
> Hi.
>
> I would like to use Proc Tabulate to get a table like the following
>
> field office all %
> Male 70 40 110 38%
> Female 120 60 180 62%
> All 190 100 290
> % 66% 34%
>
> I have been able to create the code for either the column percent or the
> row
> percent. The manual states that you cannot create a statistic on a
> statistic
> - which is what I would like to do.
>
> However, does anyone know of a way to work around this - other than a data
> step or proc freq??
>
> Test code below:
>
> Thanks
> -------------------------------------
>
> data test ;
> input gender $ dept $ salary;
> cards;
> m office 10
> f office 10
> m office 20
> f office 30
> m office 30
> f field 20
> m field 30
> f field 50
> m field 50
> m field 40
> ; run;
>
> proc tabulate data = test;
> class gender dept;
> var salary;
>
> table (gender all) ,
> dept*salary*sum all*salary*(sum pctsum)
> /condense ;
>
> table (gender * sum ) all * (sum pctsum),
> ( dept all)* salary
> / condense ;;
>
> run;
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
|