Dear Statalist,
I am having trouble with the user-written function xtile as an egen function.
My data set consists of data of numerous stocks for the period 1963 - 2016. Each stock is identified by its unique permno.
For each stock on each date (described as "time") I calculate a measure on which the xtile sorting depends on. This measure is called the "breakhigh52w2". The minimum value of this measure is 0.007 and the maximum is 1.
The distribution of this measure looks as the following:
Distribution.gph
Next, I insert the following command:
egen breakhigh52w_a = xtile(breakhigh52w), by(time) nq(10)
A histogram gives a visual representation of this variable.
Histogram.gph
Clearly, there are a lot less observations in the 10th decile. This confuses me as for each date there should be at least one observation be assigned to the 10th decile right?
I assume that the large number of observations with a "breakhigh52w2"- value of 1 and the boundary points of the deciles are responsible for this.
Does anyone has an idea how to overcome this problem?
Thanks in advance,
Huib
I am having trouble with the user-written function xtile as an egen function.
My data set consists of data of numerous stocks for the period 1963 - 2016. Each stock is identified by its unique permno.
For each stock on each date (described as "time") I calculate a measure on which the xtile sorting depends on. This measure is called the "breakhigh52w2". The minimum value of this measure is 0.007 and the maximum is 1.
The distribution of this measure looks as the following:
Distribution.gph
Next, I insert the following command:
egen breakhigh52w_a = xtile(breakhigh52w), by(time) nq(10)
A histogram gives a visual representation of this variable.
Histogram.gph
Clearly, there are a lot less observations in the 10th decile. This confuses me as for each date there should be at least one observation be assigned to the 10th decile right?
I assume that the large number of observations with a "breakhigh52w2"- value of 1 and the boundary points of the deciles are responsible for this.
Does anyone has an idea how to overcome this problem?
Thanks in advance,
Huib
Comment