10-18-2016 03:09 PM
Hi I have a got two data sets and I have shown them below. I'm trying to merge them by duplicating one of the columns "A " in dataset 1 depending on the number of entries of column "B" in dataset 2 for the same ID.
After merging I would like the result to be as follows.
I have tried the norming merging and interleaving but it doesn't work.
Does it require if the else and do looping to get this result ?
10-18-2016 03:21 PM - edited 10-18-2016 04:26 PM
EDIT - Code corrected - your joining rule has duplicate key values in both input datasets so this is best done with SQL:
proc sql; create table want as select A.ID ,A.A ,B.B from Dataset1 as A inner join Dataset2 as B on A.ID = B.ID ; quit;
10-18-2016 03:53 PM
The above code gave me a cartisian product of the two data sets. Not the result which I was looking for.Thanks anyways.
Need further help from the community? Please ask a new question.