Date: Fri, 14 Dec 2007 07:16:38 +1100
Reply-To: Doug <gordononline@OPTUSNET.COM.AU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Doug <gordononline@OPTUSNET.COM.AU>
Subject: weighting in proc tabulate
Hi
Its been almost a year since I did any serious SAS and I seem to have
forgotten how to do some things!!
I have a table, say similar to sashelp.class, and there is another table
that contains weightings for each sex (m=1.1, f=1.3)
I have merged these tables so that for each male, there is an associated
value (wgt).
If I want to use these values in my proc tabulate so that instead of
counting the records, that the weight is used, how can I achieve this and
have the row and column and table totals reflect the weights?
A sample of what I have tried is below:
data class;
set SASHELP.class;
if sex='M' then wgt=1.1;
else wgt=1.3;
run;
proc tabulate data=class;
class sex age;
weight wgt;
tables age all , sex all ;
run;
But this still only counts the records by age and sex. I would expect that
the total for females would be 11.7 and 11.0 for males and the weights to be
applied in the cells.
Thanks for any help.
Doug