Dear Statalist
I am trying to come out with some statistics but i am facing some issues :
I have two variables : wealth index (count) in five categories (WI)
and region (REG) which has 13 levels
I would like to have the proportion of each wealth index level in each region: first by this script below i have the total population per region to use as denominator
forvalues i =1/13 {
egen w`i'= count(WI) if REG==`i', by(REG)
}
and now i would like to have the population of each wealth index level in each region, to use as numerator to have the proportion of each wealth index level per region, but my script below don't give me what i am expecting
forvalues i =1/5 {
forvalues j =1/13 {
egen wi`i'_`j'= count(WI) if REG==`j' & WI==`j' , by(REG)
}
}
I will appreciate any support to overcome this issue!
best!
I am trying to come out with some statistics but i am facing some issues :
I have two variables : wealth index (count) in five categories (WI)
and region (REG) which has 13 levels
I would like to have the proportion of each wealth index level in each region: first by this script below i have the total population per region to use as denominator
forvalues i =1/13 {
egen w`i'= count(WI) if REG==`i', by(REG)
}
and now i would like to have the population of each wealth index level in each region, to use as numerator to have the proportion of each wealth index level per region, but my script below don't give me what i am expecting
forvalues i =1/5 {
forvalues j =1/13 {
egen wi`i'_`j'= count(WI) if REG==`j' & WI==`j' , by(REG)
}
}
I will appreciate any support to overcome this issue!
best!
Comment