Announcement

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

  • Create a variable in merger setting


    Hello Statalisters

    I'm trying to create a variable, which shows mayor's continuity in years 1999 and 2000 from year 1998 in the setting of municipal merger. I can't think of a wise way to write a command to create this variable using STATA. I would appreciate any advice. In the following table, Municipalities A, B, and C were merged to Municipality A in year 1999. Municipalities B and C only exist in 1998, but there are merged to Municipality A in 1999. Then, I want to create a variable if mayors in municipality A in 1999 and 2000 are from any of the merging partner municipalities (A, B, or C). In case of municipality A in 1999 and 2000, Brian was a mayor in municipality A. Therefore, I give a value of "1". But, in case of Municipality Y in 1999 and 2000, Bill is a new mayor and was not a mayor in merger partner municipalitues (X or Y). That's why I give a value of "0".

    I can't think of a way to write a command, which allows me to give a value of "1" when the new mayor was a former mayor in EITHER of the merging partner municipalities (for instance, A, B, or C). I would appreciate any advice.
    mcode mcode2 year city_name mayor_name same_mayor_1998
    1202 1202 1998 A Brian
    1202 1339 1998 B Tom
    1202 1340 1998 C Lindsey
    1202 1202 1999 A Brian 1
    1202 1202 2000 A Brian 1
    1203 1453 1998 X Casey
    1203 1454 1998 Y Joris
    1203 1203 1999 Y Bill 0
    1203 1203 2000 Y Bill 0

    Best regards,
    Kohei Suzuki
Working...
X