Bookmark and Share

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

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

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

From   davidj miller <>
Subject   st: "Too many weights" in Stata -svy- command
Date   Sun, 27 Oct 2013 08:31:35 -0400

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 "";, clear


save "E:\DEMO 2007_2008.dta", replace 

fdause "";

merge m:1 seqn using  "E:\DEMO 2007_2008.dta"


summarize wtsc2yr

svyset sdmvpsu[pw=wtsc2yr], strata[sdmvstra]

After the -svyset- command in my do file, Stata stops and returns:

 "too many weights

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 "";, 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

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

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

*   For searches and help try:

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