Dear all,
I am trying to do something conceptually fairly simple. I would like to create a group variable which tells me in which quartile an observation falls into according to the value of a variable. I have tried to do that in this way:
by group year: xtile quant=x, nq(4)
by it didn't work. I have also tried a bunch of similar codes but none seemed to be effective. The problem is that none of the functions computing quantiles accepts the by option.... Can someone suggest something better?
Many thanks!
Riccardo
I am trying to do something conceptually fairly simple. I would like to create a group variable which tells me in which quartile an observation falls into according to the value of a variable. I have tried to do that in this way:
by group year: xtile quant=x, nq(4)
by it didn't work. I have also tried a bunch of similar codes but none seemed to be effective. The problem is that none of the functions computing quantiles accepts the by option.... Can someone suggest something better?
Many thanks!
Riccardo
Comment