Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Problem with levels7 & povdeco


From   Pol Smith <polsmith1@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Problem with levels7 & povdeco
Date   Wed, 29 Nov 2006 03:39:39 -0800 (PST)

Hello,
I am having trouble with povdeco and/or levels7 in stata v. 9 - i suspect the latter. I have a dataset in which the dataset is classified by year and municipality, and I would like to generate municipal poverty rates for each year. However, when I run the program below, I get perfect results for the first year, then for each successive year the poverty rates for each municipality are far lower than they *should* be. 
I'd be extremely grateful for your help.
Many thanks,
Pol

Stata code:
gen P0muni=.
gen P1muni=.
gen P2muni=.
local pline=pline
egen var=group(year muni)
levels7 var, local (S)
foreach r of local S {
povdeco iewb [w=expc], by(var) pl(`pline')
replace P0muni=r(fgt0_`r') if var == `r'
replace P1muni=r(fgt1_`r') if var == `r'
replace P2muni=r(fgt2_`r') if var == `r'
}
drop var
save, replace



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



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