I keep running into this issue where I want to be able to assign a group id using the egen var = group(), by() command, but Stata doesn't let you use , by() option with the egen group command. Does anyone happen to know of any workaround for this?
Basically, I have a bunch of addresses listed in my data set that are identified by a particular id, and I want to assign a new and different id number (starting with 1, 2, etc.) to each different store name that appeared at each address. So I'd like to use the egen var = group(store_name), by(address) command. So for example, if there was an address with id=1 that had data for 2000-2015, I want to be able to identify how many stores there were at that address and be able to assign each of them an id starting with 1, 2, etc. So the first store that was listed at that address would get a "1" the second store would get a "2" etc. I have run into this issue is different contexts over the past year or so and am trying to find a solution. Thanks in advance for your help.
Basically, I have a bunch of addresses listed in my data set that are identified by a particular id, and I want to assign a new and different id number (starting with 1, 2, etc.) to each different store name that appeared at each address. So I'd like to use the egen var = group(store_name), by(address) command. So for example, if there was an address with id=1 that had data for 2000-2015, I want to be able to identify how many stores there were at that address and be able to assign each of them an id starting with 1, 2, etc. So the first store that was listed at that address would get a "1" the second store would get a "2" etc. I have run into this issue is different contexts over the past year or so and am trying to find a solution. Thanks in advance for your help.
Comment