Dear all
I am using the South African National Income Dynamics Survey (NIDs) and have successively created a panel dataset across all 5 waves.
I am looking to create a variable for 'household income per capita' quintiles that is categorized according to 5 percentiles so that you have the "bottom 20th percentile", "20th - 40th percentile" etc.
It should be easy enough to make since i have a derived variable for 'household income' and a variable for the number of people in a household.
I have tried using the following command:
sort w`i'_hhincome
xtile w`i'_inc = w`i'_hhincome, nq(5)
tab w`i'_inc
}
forvalues i = 1(1)5 {
// income per capita
sort w`i'_hhincome
cap gen w`i'_hh_capita = w`i'_hhincome/w`i'_hhsizer
cap xtile w`i'_inc_capita = w`i'_hh_capita, nq(5)
tab w`i'_inc_capita
}
But it ends up giving me the following result:
5 quantiles |
of |
w5_hh_capit |
a | Freq. Percent Cum.
------------+-----------------------------------
1 | 8,194 20.01 20.01
2 | 8,186 19.99 40.01
3 | 8,191 20.01 60.01
4 | 8,185 19.99 80.00
5 | 8,188 20.00 100.00
------------+-----------------------------------
Total | 40,944 100.00
Can anyone help me understand whether this is the correct way to generate such a variable as it seems odd that the percentages are so similar?
Kind regards
Sophie Gebers
Related Posts with Creating 'household income per capita' variable
How to use factor variable i.year in XTSUR command?I have 3 questions regarding XTSUR 1: When I input something like XTSUR (y1 y2 y3 = x1 x2 i.year) It…
Why set maxvar is ignored?When I set maxvar and STATA return as below, can I ask why and the solution? Code: set matsize 110…
How to cluster nothing in a code?I have a code that is Code: did2s depvar [if] [in] [weight], first_stage(varlist) second_stage(var…
STATA stuck computing matchit resultsI am attempting to match two datasets, one of which is about 70 000 observations and the other maybe…
Seeking ideas for graphical representation of binary outcome dataHello all, I have a dataset (n=301) that describes the incidence of hypothermia (binary outcome) by …
Subscribe to:
Post Comments (Atom)
0 Response to Creating 'household income per capita' variable
Post a Comment