I want to calculate the value of the decile for each county my dataset. I´m struggling with that task. Right now I´m doing:
gen size_decile = .
levelsof COUNTY, local(COUNTY_1)
foreach i in `COUNTY_1' {
pctile decile_temp=INCOME if COUNTY==`i', nq(10)
replace size_decile = decile_temp if missing(size_decile)
drop decile_temp
}
gen size_decile = .
levelsof COUNTY, local(COUNTY_1)
foreach i in `COUNTY_1' {
pctile decile_temp=INCOME if COUNTY==`i', nq(10)
replace size_decile = decile_temp if missing(size_decile)
drop decile_temp
}
Comment