[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input int ROUND_DATE long(COM_NAME STAGE)
22592 2 2
22592 2 2
22420 3 3
22420 3 3
22818 3 3
22818 3 3
22818 3 3
22818 3 3
22818 3 3
19205 4 6
21192 5 2
21192 5 2
22195 5 3
22195 5 3
22195 5 3
22195 5 3
22712 5 3
22712 5 3
22712 5 3
22712 5 3
19926 6 4
22834 7 2
22834 7 2
22834 7 2
22834 7 2
22834 7 2
22834 7 2
15809 8 1
18995 9 2
20515 9 3
20515 9 3
21444 9 3
22362 9 4
22362 9 4
22362 9 4
I have this dataset, COM_NAME is ID variable >> it was a string and I encoded it and make it numerical. As you can see, there are several observations with the same COM_NAME or ID.
What I need to do is: Keep only the first (oldest) observation for each COM_NAME.
could you please provide me with guidance on how to do this?
Many thanks
* Example generated by -dataex-. To install: ssc install dataex
clear
input int ROUND_DATE long(COM_NAME STAGE)
22592 2 2
22592 2 2
22420 3 3
22420 3 3
22818 3 3
22818 3 3
22818 3 3
22818 3 3
22818 3 3
19205 4 6
21192 5 2
21192 5 2
22195 5 3
22195 5 3
22195 5 3
22195 5 3
22712 5 3
22712 5 3
22712 5 3
22712 5 3
19926 6 4
22834 7 2
22834 7 2
22834 7 2
22834 7 2
22834 7 2
22834 7 2
15809 8 1
18995 9 2
20515 9 3
20515 9 3
21444 9 3
22362 9 4
22362 9 4
22362 9 4
I have this dataset, COM_NAME is ID variable >> it was a string and I encoded it and make it numerical. As you can see, there are several observations with the same COM_NAME or ID.
What I need to do is: Keep only the first (oldest) observation for each COM_NAME.
could you please provide me with guidance on how to do this?
Many thanks

Comment