LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2011, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 6 Jan 2011 17:44:32 -0500
Reply-To:     Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject:      finding gaps given date ranges and covered date ranges

Saw this interesting question posted on somewhere else: ----------------------------------------------------------- I have two sets of data with different date ranges. Tbl 1: ID, Date_Start, Date_End 1, 2010-01-01, 2010-01-09 1, 2010-01-10, 2010-01-19 1, 2010-01-30, 2010-01-31

Tbl 2: ID, Date_Start, Date_End 1, 2010-01-01, 2010-01-04 1, 2010-01-08, 2010-01-17 1, 2010-01-30, 2010-01-31

I'd like to find cases date ranges do not entirely overlap date ranges in Tbl 2. So for instance, in this example, I'd like output that looks something like this -- Output: ID, Gap_Start, Gap_End 1, 2010-01-05, 2010-01-07 1, 2010-01-18, 2010-01-19

Date ranges will never overlap within a table. To do this, I'm using either SQL or SAS. Unfortunately, the datasets are big enough (millions of records) that I can't just brute force it. ------------------------------------------------------------------


Back to: Top of message | Previous page | Main SAS-L page