Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte obs_number int column str16 varname 1 11 "Name of the firm" 2 11 "Name 1" 1 253 "Name of the firm" 2 253 "Name 1" end
I'm working on a reshaped dataset that have several """variables""" in one Stata variable in order to modify some strings such as "Name 1" here. Now I have two variables that are the same, namely, "Name of the firm", and they are duplicates. I want to drop all possible obs_number values for all duplicates. I could do drop if column == 253, but I have many other duplicates and I would like to do another thing than just looking at the data to report the corresponding column value. I need something like
1. check if "Name of the firm" is repeated many times in the variable varname,
2. store the values of column (for the duplicates only) in a macro
So then I could do a loop for each value of the local and drop if column == this value.
You help will be very appreciated!
0 Response to Drop all the observations if there is one duplicate
Post a Comment