Announcement

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

  • What is the difference between -merge- and -rangejoin- ?

    Hi everyone,

    I just have a quick question about the famous -merge- command, and -rangejoin-.

    I just want to know when -merge- is more suitable than -rangejoin-, and vice versa please.
    • Could anyone provide me a quick summary of these two methods, and their best applications?
    Thank you.
    Lovely day/evening/night.

    Michael

  • #2
    -merge- is used when you want to combine two data sets, pairing up their observations when there is an exact match on certain variables that are found in both.

    -rangejoin- is used when you want to combine two data sets, pairing up their observations when there is, optionally, an exact match on certain variables found in both, and, mandatorily, further restricting to those observations where the value of some variable in the using data set falls within some range defined by values in the master data set.

    Note also an important distinction in usage. -merge- treats the master and using data sets symmetrically. That is, other than perhaps requiring a switch between 1:m and m:1, it makes no difference to -merge- which data set is master and which is using: the end result is the same. That is not true of -rangejoin-, and one of the most frequent errors people make when trying to use it is getting this aspect of it wrong. With -rangejoin- it makes a huge difference which data set is master and which is using.
    Last edited by Clyde Schechter; 24 Oct 2023, 09:39.

    Comment


    • #3
      Hi Clyde Schechter:

      Thank you for providing me with one answer that I needed!

      the -rangejoin- command that you suggested is nice and useful.
      Thank you so much.

      Lovely day.
      Michael

      Comment

      Working...
      X