Announcement

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

  • Merge keep(match)

    Hello all,

    I am a bit lost with merging two datasets.
    I tried to merge two data and keep only the observations that are matched in the master data (1:m).
    Therefore, I used:
    merge 1:m id using "using_data", keep(match)

    I want to double-check if this code is identical as (or what I intended to do):
    merge 1:m id using "using_data"
    keep if _m == 3

    Thanks a lot !



  • #2
    Yes, those are the same.

    And they will retain all and only those observations where id appears in both data sets. So unmatched observations from either data set will be excluded from the result.
    Last edited by Clyde Schechter; 12 Jan 2025, 09:28.

    Comment


    • #3
      thanks for your reply ! it's clear now

      Comment

      Working...
      X