Hi there,
I have a variable exp and a time variable yyyy. I am trying to create a new variable, exp_dummy that will take a value of 0-3 based on what quartile it falls into of exp by yyyy. At the moment, the best I can come up with is to do something like:
However, this is not working for me. Can someone please help? Thanks
I have a variable exp and a time variable yyyy. I am trying to create a new variable, exp_dummy that will take a value of 0-3 based on what quartile it falls into of exp by yyyy. At the moment, the best I can come up with is to do something like:
Code:
by yyyy: egen exp_dummy = pctile(exp), p(4)
Comment