Hi, I am trying to merge two data sets. One of the datasets looks like: ID testdate1 1 09/30/2015 1 06/15/2016 1 01/05/2017 2 03/20/2017 2 04/22/2017 The number of records for each person varies. The 2nd data set looks like: ID testdate2 1 07/06/2016 1 01/02/2017 2 05/19/2017 2 10/20/2017 I can only match them using ID. What I want is: ID testdate1 testdate2 Indicator 1 06/15/2016 07/06/2016 1 1 01/05/2017 01/02/2017 1 If the interval between testdate1 and testdate2 is greater than 6 months, an indicator variable will be coded 1, otherwise the indicator variable is coded 0. When I used the ID to merge the two datasets, it turns out to be ID testdate1 testdate2 Indicator 1 09/30/2015 07/06/2016 0 1 06/15/2016 01/02/2017 0 1 01/05/2017 01/02/2017 1 In the merged dataset above, the first person is mismatched. I want testdate1=06/15/2016 to be matched with 07/06/2016 and testdate1=09/30/2015 should not be matched with any records in data set 2. Thanks!
... View more