Hi all!
I am running a stata project investigating impacts of mergers on manufacturing plants, and I have thus far been able to identify using firm IDs whether an establishment has recently been involved in acquisitions by seeing if the establishments associated with a single firmID are associated with multiple lagfirmIDs. That is,
I can also do this only counting mergers where merging establishments are in the same county:
My question is: If I have a crosswalk for each county of every neighboring county, is there an easy way to check if a firm is associated with mergers where merging establishments are in the same county OR a neighboring county? The crosswalk looks something like this. I've mulled over using a for loop to just replace County with Neighbor(n) and then iterate through the above code, but that just checks the second column against itself, not the first column against each of the others. Thanks as always for the help!
I am running a stata project investigating impacts of mergers on manufacturing plants, and I have thus far been able to identify using firm IDs whether an establishment has recently been involved in acquisitions by seeing if the establishments associated with a single firmID are associated with multiple lagfirmIDs. That is,
Code:
sort year firmID lagfirmID, stable uniqueCount = (lagfirmID != lagfirmID[_n-1] & lagfirmID != .) egen totalPASTfirms = total(uniqueCount), by(year firmID) gen acqHappened = (totalPASTfirms > 1)
Code:
sort year firmID county lagfirmID, stable uniqueCount = (lagfirmID != lagfirmID[_n-1] & lagfirmID != .) egen totalPASTfirms = total(uniqueCount), by(year firmID county) gen acqHappenedCounty = (totalPASTfirms > 1) egen acqHappened = max(gen acqHappenedCounty), by(year firmID)
County | Neighbor1 | Neighbor2 | Neighbor3 | Neighbor4 |
1 | 1 | 5 | 6 | 7 |
5 | 5 | 1 | 9 | 11 |
Comment