# st: Single PSU - problem with SVYDES to estimate variance

 From "Patrick Wöhrle Guimarães" To statalist@hsphsun2.harvard.edu Subject st: Single PSU - problem with SVYDES to estimate variance Date Sat, 3 Mar 2007 20:38:51 -0300

``` Im working with complex design and I have stratum with Single PSU
because this - I need to solve this problem for estimate variance. My
first step is:

svyset psu [pweight=peso], strata(strat) (define complex design)
svydes rendapc2, single

With this information - I have a ado-file to agregate stratum with
single psu in stratum with more high observation in the same State (or
next). My problem is that the SVYDES doesn´t find one stratum that has
a single psu (in the list the stratum that has single psu only this
stratum doesnt appear (the number 53) -  I dont know why?).

rendapc2 = personal income per capita

* ROTINA DE ALOCACAO DE ESTRATOS COM UM UNICO PSU EM ESTRATOS COM MAIOR NUMERO
* DE OBSERVACOES UTILIZANDO O DO.FILE idonepsu rendapc - PARA A
VARIAVEL RENDPC2 - ANO DE  2005

keep if uf < 11
gene novo_str = .
gene novo_psu = .
format novo_psu %12.0g

capture program drop prog1
program define prog1
gene novo_str = strat
gene novo_psu = psu
quietly {
}
end

capture program drop prog2
program define prog2
idonepsu rendapc2 , generate(novo_) strata(strat)  psu(psu)
quietly {
}
end

*foreach i in 53   {
*     prog1
*}

foreach i in 11 12 13 14 15 16 17 21 22 23 24 25 26 27 28 29 31 32 33
35 41 42 43 50 51 52 53  {
prog2
}

drop strat psu
rename novo_str strat
rename novo_psu psu

svyset [pw=peso], strata(strat) psu(psu)

--

Patrick

*
*   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/
```