I have a continuous variable in some panel data (xtset by id and year over 5 years) that I would like to create quintiles of:
I use the function xtile() from egenmore (SSC) to do this as below:
However, when I go to examine the data it has quintile 1, 3, 4 and 5. Quintile 2 is missing, can anyone help me to understand why this is happening and how to fix it?
Thank you,
John
Code:
. sum O_SDQpeerprobs_y Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- O_SDQpeerp~y | 32,090 1.070988 1.407768 0 10
Code:
. egen O_SDQpeerprobs_yQ5 = xtile(O_SDQpeerprobs_y), nq(5) (23580 missing values generated)
Code:
. tab O_SDQpeerprobs_y O_SDQpeerprobs_yQ5 O_SDQpeerp | O_SDQpeerprobs_yQ5 robs_y | 1 3 4 5 | Total -----------+--------------------------------------------+---------- 0 | 15,189 0 0 0 | 15,189 1 | 0 7,808 0 0 | 7,808 2 | 0 0 4,718 0 | 4,718 3 | 0 0 0 2,200 | 2,200 4 | 0 0 0 1,188 | 1,188 5 | 0 0 0 492 | 492 6 | 0 0 0 278 | 278 7 | 0 0 0 131 | 131 8 | 0 0 0 57 | 57 9 | 0 0 0 19 | 19 10 | 0 0 0 10 | 10 -----------+--------------------------------------------+---------- Total | 15,189 7,808 4,718 4,375 | 32,090
Thank you,
John
Comment