Hi everyone,
I have the variable Household size (hhmemb) with 5.000 observations and the income for each household. Now I want to group the variable household size into 1 Person Households, 2 Person Household ... 5+ Person Household. Within these Groups I want to build Quintiles according to the income. I tried the following:
gen hhgroup = cond(hhmemb == 1, "1 Person Household", ///
hhmemb == 2, "2 Person Household", ///
hhmemb == 3, "3 Person Household", ///
hhmemb == 4, "4 Person Household", ///
hhmemb >= 5, "5+ Person Household", ///)
sort hhgroup inc
by hhgroup: egen q20 = pctile(inc), p(20)
by hhgroup: egen q40 = pctile(inc), p(40)
by hhgroup: egen q60 = pctile(inc), p(60)
by hhgroup: egen q80 = pctile(inc), p(80)
list hhgroup Income q20 q40 q60 q80
The first part works fine but then stata says: "variable hhgroup not found".
I have the variable Household size (hhmemb) with 5.000 observations and the income for each household. Now I want to group the variable household size into 1 Person Households, 2 Person Household ... 5+ Person Household. Within these Groups I want to build Quintiles according to the income. I tried the following:
gen hhgroup = cond(hhmemb == 1, "1 Person Household", ///
hhmemb == 2, "2 Person Household", ///
hhmemb == 3, "3 Person Household", ///
hhmemb == 4, "4 Person Household", ///
hhmemb >= 5, "5+ Person Household", ///)
sort hhgroup inc
by hhgroup: egen q20 = pctile(inc), p(20)
by hhgroup: egen q40 = pctile(inc), p(40)
by hhgroup: egen q60 = pctile(inc), p(60)
by hhgroup: egen q80 = pctile(inc), p(80)
list hhgroup Income q20 q40 q60 q80
The first part works fine but then stata says: "variable hhgroup not found".
Comment