I am hoping to filter my dataset by date in reference to the date of another variable. In the example below, I would like to keep the observation if date2 is within date1 + 7 days (or if missing). [Alternatively, I'd like to remove an observation if date2 is present and not within date1 + 7 days].
Sample dataset:
Obs Date1 Date2
1 10/21/88 10/23/88
2 6/18/89 6/30/89
3 2/20/89 2/22/89
4 4/18/87 .
In the set above, I would like to keep obs 1, 3 & 4.
Thank-you in advance!