Hello Everyone, I have a sample dataset shown below. Each ID has different dates. I want to choose the observations within 15day period from the oldest date for each ID. For the observations with only one date per ID should appear in the output. For example in the below dataset I have the dates sorted by ID and date. Date ID 1/2/2013 1 1/3/2013 1 1/25/2013 1 4/25/2014 2 2/6/2014 3 2/8/2014 3 3/8/2014 3 5/7/2013 4 4/4/2013 5 4/4/2013 5 6/5/2013 5 5/9/2014 6 8/16/2014 6 I need the output as shown below. 1/2/2013 1 1/3/2013 1 4/25/2014 2 2/6/2014 3 2/8/2014 3 5/7/2013 4 4/4/2013 5 4/4/2013 5 In the above output dataset, For the first ID, the third observation is eliminated as the date difference between the oldest date and the third observation date was above 15 days (i.e 23 day gap). For the sixth ID, the date difference was above 15days so both the observations got deleted. Second and Fourth ID were not changed as it had only one date per ID. Please guide me in coding this. Thank you in advance.
... View more