Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • County Adjacency Check

    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,

    Code:
    sort year firmID lagfirmID, stable
    uniqueCount = (lagfirmID != lagfirmID[_n-1]  & lagfirmID != .)
    egen totalPASTfirms = total(uniqueCount), by(year firmID)
    gen acqHappened = (totalPASTfirms > 1)
    I can also do this only counting mergers where merging establishments are in the same county:


    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)
    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!
    County Neighbor1 Neighbor2 Neighbor3 Neighbor4
    1 1 5 6 7
    5 5 1 9 11

  • #2
    You'll substantially increase your chances of quickly getting some useful help if, per the StataList FAQ, you post a data example from each of your files, using the -dataex- command. Verbal descriptions of data structures are almost always hard to understand. Although it might in principle be possible for someone here to figure out the logical and operational structure of your data files from what you've posted, you can make it easy for people by providing examples. I'd also say that your phrase "if a firm is associated with mergers" is obscure, as I don't know what "associated" means in this context. You've also referred to a variable "lagfirmID" whose meaning you know but which the others of us don't.

    Comment

    Working...
    X