Announcement

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

  • Vlookup question

    Hi. This is a simple question but somehow I cant figure out the code. I want to transform the following dataset:
    Code:
    input id1 volume_productx id2 volume_producty
    1 100 2 150
    2 300 4 400
    3 50 2 150
    4 600 5 400
    5 200 3 250
    end
    Into this format:
    Code:
    input id1 volume_productx volume_producty
    1 100 .
    2 300 150
    3 50 250
    4 600 400
    5 200 400
    end
    I have looked at the vlookup package and have tried merging but to no avail.

  • #2
    Fixed this already..
    Code:
    vlookup id1, gen(vol_prody_new) key(id2) value(volume_producty)
    drop id2 volume_producty

    Comment

    Working...
    X