Hello Statalisters,
I'm totally new to this forum and relatively new to Stata, so I hope I'm doing everything right. My situation is the following:
I have a pooled data set consisting of four cross-sections. Variables of interest are the income and the household type (1 to 5). Creating income groups within the periods is no problems, so that i get this e.g.:
this can be easily done while looping over the xtile command:
gen group=.
forvalues t=$tmin(5)$tmax{
sort income
xtile trash=income if year==`t', nq(3)
replace group=trash if year==`t'
drop trash
}
My problem is now that I want more diversified groups. The aim is to get three income groups for each household type in each period. I have tried several ways but didn't get what I wanted.
Thanks in advance!
I'm totally new to this forum and relatively new to Stata, so I hope I'm doing everything right. My situation is the following:
I have a pooled data set consisting of four cross-sections. Variables of interest are the income and the household type (1 to 5). Creating income groups within the periods is no problems, so that i get this e.g.:
year | income | group |
1 | 2 | 1 |
1 | 4 | 2 |
1 | 6 | 3 |
2 | 3 | 1 |
2 | 5 | 2 |
2 | 7 | 3 |
3 | 1 | 1 |
3 | 4 | 2 |
3 | 8 | 3 |
this can be easily done while looping over the xtile command:
gen group=.
forvalues t=$tmin(5)$tmax{
sort income
xtile trash=income if year==`t', nq(3)
replace group=trash if year==`t'
drop trash
}
My problem is now that I want more diversified groups. The aim is to get three income groups for each household type in each period. I have tried several ways but didn't get what I wanted.
Thanks in advance!
Comment