Date: Wed, 12 Oct 2011 16:05:03 -0400
Reply-To: David Friedman <harrypotterdhf@EARTHLINK.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David Friedman <harrypotterdhf@EARTHLINK.NET>
Subject: Re: Collapsing Date Intervals
Thanks, Jack. The only thing is I think your code would include a "gap" if
there was no overlap. For example, I added an additional input record for #3
2/6/11-2/20/11. Since it doesn't overlap and there is a Gap from
1/16/11-2/6/11, I won't want to close the Gap. The output for #3 would have
the same two records as the input since there is a Gap and no overlap.
Input:
id # start date stop date
---- ---------- ----------
1 1/1/11 1/30/11
1 1/3/11 2/3/11
2 2/1/11 2/15/11
2 2/3/11 2/5/11
3 1/5/11 1/16/11
3 2/6/11 2/20/11
Desired output:
id # start date stop date
---- ---------- ----------
1 1/1/11 2/3/11
2 2/1/11 2/15/11
3 1/5/11 1/16/11
3 2/6/11 2/20/11
|