I want to be able to return the minimum days between two dates based on two data sets, by ID number. For instance suppose the two data sets contain the following: Data Set 1: Data Set 2: ID Dt1 ID Dt2 1 3Mar2017 1 3Mar2017 1 5Mar2017 2 5Apr2017 2 12Mar2017 2 20Apr2017 3 1Apr2017 3 22Apr2017 3 4Apr2017 3 1Apr2017 3 20Apr2017 4 2Mar2017 5 5May2017 6 3Jun2017 The process will need to return the information to Data set 1. The data will cycle through the first data set comparing the IDs. If the ID in data set 1 is the same as the ID in data set 2, then take the difference of the Dates. Repeat this process until the ID in data set 2 does not match the ID in data set 1. However, for each iteration, keep the minimum date and days between. Data Set 1 Return Info: ID Dt1 Dt2 Days_Between 1 3Mar2017 3Mar2017 0 1 5Mar2017 3Mar2017 2 * 2 12Mar2017 5Apr2017 24 3 1Apr2017 1Apr2017 0 3 4Apr2017 1Apr2017 3 3 20Apr2017 22Apr2017 2 4 . 2Mar2017 . ** 5 5May2017 . . ** Note: * This this can be negative ** If the ID is not present in either data return a NULL
... View more