I have a data set with observations of 3.4 million. I am trying xtile funciton of egenmore, but is too slow
where date_ser is time variable and Ri_Rm are stock returns, for which I want to create 10 quartiles on each specific date. As an laternative, I was trying to do the same with
However, it does not assign _n the way i wanted, i.e. to first sort with day_ser and withing that sorting assign _n based on Ri_Rm. Your help and comments will be appreciated.
Code:
egen PF=xtile(Ri_Rm) , by( date_ser) nq(10)
Code:
bys date_ser Ri_Rm : gen PF= int(10*(_n - 1) / _N) + 1