Dear Statalist-Forum,
I have the following variables: CUSIP, news and year. Thereby, news is the number of news per CUSIP (stock identifier) per year. I create deciles of news within a particular year by using the following code:
When further examining the decile variable, I find that the number of observations within a decile for a given year are different.
For example:
This returns 74 observations.
This only returns 62 observations.
Can somebody tell me if my code to form the deciles is correct? Or alternatively, what might be possible reasons for the discrepancy in the number of observations in the deciles?
Thanks for your help.
I have the following variables: CUSIP, news and year. Thereby, news is the number of news per CUSIP (stock identifier) per year. I create deciles of news within a particular year by using the following code:
Code:
gen decile =. levelsof year, local(tempyear) foreach i in `tempyear' { xtile decile_temp= news if year==`i', nq(10) replace decile = decile_temp if missing(decile) drop decile_temp }
For example:
Code:
codebook decile if decile == 1 & year == 2000
Code:
codebook decile if decile == 2 & year == 2000
Can somebody tell me if my code to form the deciles is correct? Or alternatively, what might be possible reasons for the discrepancy in the number of observations in the deciles?
Thanks for your help.
Comment