Hello,
I have a question on how to use r(sum) with by. I am working with SCF data and I am trying to compute the number of individuals in the top decile income group, weighted with the sample weights, for each survey year.
I tried doing it this way:
I need to create a variable that would contain the number of observations for each year. However, I am not sure how to save the number of observations when using bys.
Would appreciate any help.
I have a question on how to use r(sum) with by. I am working with SCF data and I am trying to compute the number of individuals in the top decile income group, weighted with the sample weights, for each survey year.
I tried doing it this way:
Code:
gen howmany=1 bys year: sum(howmany) [aw=wgtI95W95] if incgroup==10
Would appreciate any help.
Comment