[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: error using survwgt

Subject   Re: st: error using survwgt
Date   Wed, 8 Jul 2009 18:04:03 -0400

The error message means exactly what it says and has nothing to do
with missing values.   Here's an example with two control variables
(gender, agegp) and control total variables.

gender       gender_tot
1 (male)     1,822
2 (female)  3000

agegp            agegp_tot
1 (<=20)     1000
2 (21-40)    2000
3 (41+)       1644

If you then run

survwgt rake old_wt,  ///
by(gender agegp) totvars(gender_tot agegp_tot)    ///

you will get exactly the error message that you quote, because the
population total summing over genders is 4822, but summing over age
groups is 4644.
This usually happens if  control totals come from different sources.
Whatever the cause, you will have to adjust the totals so that they
sum exactly to the same value for each control variable ("dimension").
 For example, you could multiply the gender_tot values by 4644/4822,
round to the nearest 1, then add or subtract to make the gender totals
sum exactly to 4644.

 If you DID have missing values for gender or agegp, you would have to
create new control variables, say xgender xagegp, and the
corresponding tot variables, then impute values where the original
variables are missing.  In other words.  someone with missing age
would get assigned an xagegp value of 1, 2, or 3.


On Wed, Jul 8, 2009 at 5:30 PM, Kate Kelsey<> wrote:

> I am using STATA 9.
> Here is my code:
> . survwgt rake perwt, by(child sex ) totvar(tot_child tot_sex)
> generate(weight3) maxrep(1000)
> and here is the error I get:
> totals across dimensions 1 and 2 are not equal
> Why would I be getting this error?

Steven Samuels
18 Cantine's Island
Saugerties NY 12477
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index