Announcement

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

  • Merging on country pairs regardless of order

    Hello,

    I need to merge two datasets, each of which have two variables that together identify a country pair: e.g. country1=="USA"and country2=="CAN". My issue is that I need them merged regardless of the whether they appear like this or in reverse, i.e. country1=="CAN" and country2=="USA".

    I played around creating a single identifier variable, but I couldn't figure it out.

    Any ideas will be greatly appreciated!

  • #2
    Discussed at https://www.stata-journal.com/sjpdf....iclenum=dm0043

    dm0043 is thus a search term for several related threads.

    Comment


    • #3
      Thank you! With some modification of the conditional statement, it worked - the key was to know that < and > work alphabetically with strings.

      Comment

      Working...
      X