Hi I have two data sets data one: id date1 1 01/01/2016 1 01/08/2016 1 02/06/2016 1 03/07/2016 2 01/05/2016 2 01/12/2016 2 02/09/2016 2 03/11/2016 3 01/02/2016 3 01/03/2016 3 02/08/2016 3 03/03/2016 data two: id date2 1 01/03/2016 1 01/09/2016 1 03/08/2016 2 01/06/2016 2 03/12/2016 3 01/04/2016 3 02/09/2016 3 03/04/2016 how to merge these two data sets by the condition that 0<=(date2-date1)<=2 days by ID? The final data should be like: id date1 date2 1 01/01/2016 01/03/2016 1 01/08/2016 01/09/2016 1 02/06/2016 1 03/07/2016 03/08/2016 2 01/05/2016 01/06/2016 2 01/12/2016 2 02/09/2016 2 03/11/2016 03/12/2016 3 01/02/2016 01/04/2016 3 01/03/2016 01/04/2016 3 02/08/2016 02/09/2016 3 03/03/2016 03/04/2016 Please note the two data has different # of id. Thanks, Leo
... View more