I am trying to generate a new variable which consecutively categorises an existing category. I am not sure how to explain this, except by an example:
I have var1, and I want to generate var2. Because I am not sure how to word or explain my problem, I am not quite sure where to look for a solution. I may not require the complete solution, but if I am pointed in the right direction (or command / function) I am sure I can figure it out. (once I find the solution, I will post it for closure).
My question therefore is which command or function will allow me to generate var2 in the example above?
Thank you so much.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(var1 var2) 2 1 2 1 2 1 2 1 2 1 0 2 0 2 0 2 2 3 2 3 0 4 0 4 0 4 2 5 2 5 0 6 end
My question therefore is which command or function will allow me to generate var2 in the example above?
Thank you so much.
Comment