Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: "Too many weights" in Stata -svy- command


From   William Buchanan <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: "Too many weights" in Stata -svy- command
Date   Sun, 27 Oct 2013 08:14:22 -0500

Have you tried using the same characters as your example?  You're using square brackets for the strata variable, and comparing it to the example which uses parentheses.  Since the square brackets are typically used for weights, it might be a case of using the wrong character.

Sent from my iPhone

> On Oct 27, 2013, at 7:31, davidj miller <[email protected]> wrote:
> 
> 
> 
> Dear Statalisters: 
> 
> I am trying to combine two downloadable files from the US's National Center for Health Statistics and use these to estimate  various percentiles and standard errors for chemical  measurements.  The psu (sdmvpsu) and strata (sdmvstra)  information are contained in one file and the sample weight the tI want to use wtsc2yr)  info is contained in the second file.  This is the do file I set up:
> 
> 
> fdause "ftp://ftp.cdc.gov/pub/Health_Statistics/nchs/nhanes/2007-2008/DEMO_E.XPT";, clear
> 
> describe
> 
> save "E:\DEMO 2007_2008.dta", replace 
> 
> fdause "ftp://ftp.cdc.gov/pub/Health_Statistics/nchs/nhanes/2007-2008/OPD_E.XPT";
> 
> merge m:1 seqn using  "E:\DEMO 2007_2008.dta"
> 
> des
> 
> summarize wtsc2yr
> 
> 
> svyset sdmvpsu[pw=wtsc2yr], strata[sdmvstra]
> 
> 
> 
> After the -svyset- command in my do file, Stata stops and returns:
> 
> "too many weights
> r(198);"
> 
> So I tried to simplify the problem by 'svyset-ing just the demographic file (DEMO_E.XPT") to see if the problem re-occurred using a different set of sampling weights that occur in that file (wtint2yr) and avoid  potential problem introduced by -merge- and I ended up with the same "too many weights" message.  
> 
> 
> . fdause "ftp://ftp.cdc.gov/pub/Health_Statistics/nchs/nhanes/2007-2008/DEMO_E.XPT";, clear
> 
> . summarize sdmvpsu wtint2yr sdmvstra
> 
>    Variable |       Obs        Mean    Std. Dev.       Min        Max
> -------------+--------------------------------------------------------
>     sdmvpsu |     10149    1.510986    .4999039          1          2
>    wtint2yr |     10149    29277.38     26009.7   2359.374   186295.5
>    sdmvstra |     10149    65.51306    4.253306         59         74
> 
> 
> . svyset sdmvpsu[pweight=wtint2yr], strata[sdmvstra] 
> too many weights
> r(198)
> 
> 
> 
> Simplifying further using the auto data set with foreign, mpg, and rep78 to represent psu, weight, and strata, respectively,  the same thing happens: 
> 
> . sysuse auto
> (1978 Automobile Data)
> 
> . svyset foreign[pweight=mpg], strata[rep78] 
> too many weights
> r(198);
> 
> 
> Interestingly, the example in the Stata -svy- command help file works fine:  
> 
> . webuse nhanes2f
> 
> .     . svyset psuid [pweight=finalwgt], strata(stratid)
> 
>      pweight: finalwgt
>          VCE: linearized
>  Single unit: missing
>     Strata 1: stratid
>         SU 1: psuid
>        FPC 1: <zero>
> 
> .     . svy: mean zinc
> (running mean on estimation sample)
> 
> Survey: Mean estimation
> 
> Number of strata =      31       Number of obs    =       9189
> Number of PSUs   =      62       Population size  =  104176071
>                                 Design df        =         31
> 
> --------------------------------------------------------------
>             |             Linearized
>             |       Mean   Std. Err.     [95% Conf. Interval]
> -------------+------------------------------------------------
>        zinc |   87.18207   .4944827      86.17356    88.19057
> --------------------------------------------------------------
> 
> .     . mean zinc
> 
> Mean estimation                     Number of obs    =    9189
> 
> --------------------------------------------------------------
>             |       Mean   Std. Err.     [95% Conf. Interval]
> -------------+------------------------------------------------
>        zinc |   86.51518   .1510744      86.21904    86.81132
> --------------------------------------------------------------
> 
> . 
> 
> 
> 
> There was a "too many weights" problem addressed on Statalist earlier, but I did not see that as being applicable. 
> 
> I have done this kind of -merge-ing and -svyset-ing before (using Stata 11) and didn't seem to have problems, and I didn't see anything in the Stata 13 manual indicating any changes in this (at least from Stata 12)
> 
> 
> I am  using Stata 13 SE for PC
> 
> Thank you for any help you can provide.  
> 
> David Miller
> 
> 
> 
> 
> 
> [email protected]
> 
> 
> 
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index