Hi folks. I have a dataset of this form:
and I would like to make a variable "id2" that takes on the value 1 for observations 1-3, 2 for observations 4-6, etc. This is the format I would like:
Any idea how to do this? It's probably an easy fix, but I can't figure it out. Thank you so much!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(id dist wc) 1 60 3 1 90 2 1 10 3 1 30 1 1 90 3 1 10 2 1 10 4 1 60 3 1 90 1 2 90 2 2 50 2 2 10 3 2 60 1 2 30 4 2 30 1 2 90 3 2 10 2 2 40 3 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(id id2 dist wc) 1 1 60 3 1 1 90 2 1 1 10 3 1 2 30 1 1 2 90 3 1 2 10 2 1 3 10 4 1 3 60 3 1 3 90 1 2 4 90 2 2 4 50 2 2 4 10 3 2 5 60 1 2 5 30 4 2 5 30 1 2 6 90 3 2 6 10 2 2 6 40 3 end
Comment