Announcement

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

  • Tricky matching

    Hello everyone, I've been struggling with some matching for a while and really appreciate any suggestion. Thank you all very much for your help.
    Last edited by Han Norsenberg; 07 Aug 2017, 15:23.

  • #2
    There's 2 data sets. The first one has 1 X with many Ys
    # X Y Other vars
    1 X0 Y0 ....
    2 X0 YY0
    3 X1 Y0

    Y0 can change to Y1 at t1, then change to Y2 at t2 and change again in some cases where t1 and t2 are between t0 and T.

    The second data set has 1 Y with many Xs where the Y continue to be in the data set for a while after the time of change.
    Date Y X Other vars
    t0 Y0 X0
    X1
    X2
    .....
    YY0 X0
    X1
    X2
    t1 Y0 X2
    X3
    X4
    Y1 X1
    X3
    X4
    YY0 X0
    X2
    X3
    t2 Y1 X2
    X4
    X5
    Y2 X0
    X3
    X5
    I want to identify the time that X appears in both data set and together with other vars. Ideally, the output should look something like this
    Date X Matched Other vars
    t0 X0 Y0 ...
    t0 X0 YY0
    t0 X1 Y0
    t1 X1 Y1
    t2 X0 Y2

    Comment

    Working...
    X