# Re: st: how to set marginals for raking in survwgt

 From Steven Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: how to set marginals for raking in survwgt Date Tue, 13 Feb 2007 17:08:16 -0500

You set up a "tot" variable for each characteristic
For example:

gen race_tot=2408 if race==1
repl race_tot=159 if race==2
etc.

gender 1 2
gen gender_tot=1463 if gender==1
replace gender_tot=1547 if gender==2

gen age_tot =485 if age==1
replace age_tot=518 if age==2
etc.

THEN
in the -survwgt- statement, use totvars(race_tot gender_tot age_tot)

survwgt rake preweigh, by(race gender age) totvars(race_tot gender_tot age_tot) generate(newwt)

Steve

On Feb 13, 2007, at 4:14 PM, Long, Sharon wrote:

Hello,
I'm trying to figure out how to set up the totvars(varlist) part of the
survwgt command for raking my sample using age, race, and gender, where age
takes on 4 values, race takes on 4 values, and gender takes on 2 values. I
think I want to do:

survwgt rake preweigh, by(race gender age) totvars(varlist) generate (newwt)

I can't figure out how to set up the varlist for totvars with the values
for the marginals. The marginals are 2408 159 238 & 205 for race, 1463 &
1547 for gender, and 485 518 1139 & 868 for age.

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/