I have two datasets, the first dataset(DF1) is a treatment group, has ID, var1, var2, result four variables. ID and result are same for a person. but var1 and var2 are changing. Please notice each person has different row number. like ID1 has 3 rows, ID2 has only 2.
ID var1 var2 result
1 30 2013-11-23 2014-06-26
1 30 2013-12-23 2014-06-26
1 30 2014-1-23 2014-06-26
2 60 2013-10-06 2014-05-10
2 30 2014-01-6 2014-05-10
The second dataset (DF2)has same variable as ID, var1, var2. But it doesn't has result.
ID var1 var2
a 30 2013-10-23
a 30 2013-11-23
a 30 2014-12-23
b 60 2013-10-06
b 30 2014-01-06
b 30 2014-02-03
My question is, what kind of method can I use to give each person in DF2 a result based on var1, var2 comparing to DF1? I think it may impossible for person in DF1 has totally same var 1 and var 2 as DF2..
Thank you so much for any help in advance!
?merge
– SymbolixAU