I have actually tried both the ways I know of, but haven't succeeded. Guess I should have included it here, sorry. I know that when merging I should merge by one or several common variables, but since data1 and data2 have only ID as common variable the basic code: Data dataNEW; merge data1 data2 by ID; does not work, because the output will look like this: ID testday yield Age Weight 20 1 200 180 200 20 2 250 300 300 30 1 190 180 200 I have also tried the code with the in-statement: Data dataNEW; merge data1 (in=a) data2; by ID ; if a=1;run; My merge skills kind of stops here... But maybe one solution could be to make a variable called "Age" in data1, and then run a do-statement to give the Age variable the variables 180 and 300... Then I could use the "normal" by-statement in the merge procedure ! Hmm... I haven't thought of that solution before... Guess it could be done in other ways as well, but it should work. Thanks Patrick, It actually helps to find a solution only by writing down what the problem is, so I will remember that the next time I have problems in SAS!
... View more