Hello dear community,
I am really new to Stata. For my work I have to deal with the SOEP, a survey data set from Germany. I stumpled over an interesting fact that I can't explain and which gives me some strange values.
My data set is person based. Among others every person has a variable "income" and a weight. The ladder is an analytic weight. Now I want to calculate the deciles and their means and shares. For that I am using xtile the following way:
Now, interestingly enough the fact, that the observations in each decile are not equal to one another. But there is more. When I use
I observed that the column sum might be wrong. Because when I multiply mean*n I should get sum, but I do not.
My suggestion is, that there is something strange going on with the weights. Because when I delete them, each decile has equal observations. But unfortunately I need to use those weights and therefore can not work without them. I read the help file for xtile and they mentioned that it is possible to use weights. But now I face the fact that using them, something goes wrong.
Do you have any suggestions or hints?
I would be glad about some comments and answers since I am struggleing with this problem for quite a while.
Thanks in advance
I am really new to Stata. For my work I have to deal with the SOEP, a survey data set from Germany. I stumpled over an interesting fact that I can't explain and which gives me some strange values.
My data set is person based. Among others every person has a variable "income" and a weight. The ladder is an analytic weight. Now I want to calculate the deciles and their means and shares. For that I am using xtile the following way:
Code:
xtile xct = income [aweight=weight], nquantiles(10)
Code:
tabstat income [aweight=weight], stat(n mean sum max) by(xct) save
My suggestion is, that there is something strange going on with the weights. Because when I delete them, each decile has equal observations. But unfortunately I need to use those weights and therefore can not work without them. I read the help file for xtile and they mentioned that it is possible to use weights. But now I face the fact that using them, something goes wrong.
Do you have any suggestions or hints?
I would be glad about some comments and answers since I am struggleing with this problem for quite a while.
Thanks in advance
Comment