Announcement

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

  • Merge with duplicates in the using data set

    Hi,
    I would like to merge two data sets. Dataset A contains the values of the variable x. Among them are duplicates and missing values. Dataset B contains the variables x and y. In the dataset B the variables x are unique, i.e. no duplicates and missing values. The variable y does contain duplicates, i.e. some unique values of x correspond to the same y value. I have tried "merge m:1 using dataset B", but I ve received the errror message that "the variable x does not uniquely identify observations in the using data", which makes sense. Dropping the duplicates from dataset B is not an option. The task I would like to perform would be quite easy in excel with the vlookup function, however this is not possible due to a high number of observations. Do you have any suggestions?

    Thank you very much
    Best
    Denis

  • #2

    My datasets look the following way.
    A B B
    x1 x1 y1
    x1 x2 y1
    missing value x3 y1
    x2 x4 y2
    xn xn yn
    Last edited by Denis Farber; 04 Feb 2019, 07:38.

    Comment


    • #3
      You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions. I'm not sure exactly what rule you're using to merge the data sets.

      If you're just trying to match the first observation in each and the second observation in each, etc. , you could just create a variable g ob=_n in both and the merge on ob.

      Comment

      Working...
      X