Statalist


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

Re: st: error using survwgt


From   "Kate Kelsey" <[email protected]>
To   [email protected]
Subject   Re: st: error using survwgt
Date   Wed, 8 Jul 2009 15:57:02 -0700 (PDT)

That worked.
Thank you,
Kate Kelsey

> 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)    ///
> gen(new_wt)
>
> 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.
>
> -Steve
>
> On Wed, Jul 8, 2009 at 5:30 PM, Kate Kelsey<[email protected]> 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
> [email protected]
> 18 Cantine's Island
> Saugerties NY 12477
> USA
> 845-246-0774
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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