Dear all,
I am trying to bottom and top coding the household income for each country - wave.
I am using the following loop that I already successfully used with another data source:
levelsof country, local(c)
levelsof wave, local(w)
foreach country in `c' {
foreach wave in `w' {
sum hi100_equ [aw=new_weight] if country==`country' & wave==`wave', det
local bottom_hi=r(mean)/100
sum hi100_eur [aw=new_weight] if country==`country' & wave==`wave', det
local top_dhi=10*r(p50)
disp `bottom_hi'
disp `top_hi'
replace adjusted_hi=`top_hi' if hi100_eur>`$top_hi' & country==`country' & wave==`wave'
replace adjusted_hi=`bottom_hi' if hi100_eur<`$bottom_hi' & country==`country' & wave==`wave'
}
}
I want to replace the income below the 1% of the equivalised household income with that 1%, and those greater than 10 times the median of non-equivalised with the value corresponding to the 10 times median.
However, Stata returns the following error: if not found.
I cannot understand what's the error, can anyone help me?
Thank you