Announcement

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

  • Is the many to many merge done in a random way?

    Thank you!

  • #2
    The documentation for merge in the Stata Data-Management Reference Manual PDF has this to say about the m:m merge. And in previous topics, experienced users of Stata agree that using an m:m merge is generally an incorrect approach.
    m:m merges

    m:m specifies a many-to-many merge and is a bad idea. In an m:m merge, observations are matched within equal values of the key variable(s), with the first observation being matched to the first; the second, to the second; and so on. If the master and using have an unequal number of observations within the group, then the last observation of the shorter group is used repeatedly to match with subsequent observations of the longer group. Thus m:m merges are dependent on the current sort order—something which should never happen.

    Because m:m merges are such a bad idea, we are not going to show you an example. If you think that you need an m:m merge, then you probably need to work with your data so that you can use a 1:m or m:1 merge. Tips for this are given in Troubleshooting m:m merges below.
    You can read much more about the merge command in the documentation referenced above. Also keep in mind the joinby command, documented in the same manual, which does something similar to merge.



    Comment


    • #3
      Gonzalo:
      during those years I made up my mind that Stata probably included -m:m- just to top off the menu of this useful command.
      As William said, echoing what Stata manual reports, -m:m- merges are, in general a very bad idea, and, as such, should be avoided (or, better, forgotten).
      Kind regards,
      Carlo
      (StataNow 18.5)

      Comment


      • #4
        Given the dire warnings against it, I keep wondering why m:m survives at all. Maybe there is some wildly esoteric situation when it would be appropriate, but Stata Corp doesn't want to tell you what it is.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        Stata Version: 17.0 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment

        Working...
        X