LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (July 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 30 Jul 2008 14:13:41 -0400
Reply-To:     Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Subject:      Re: Help with excluding events between two dates
Comments: To: Richard Van Dorn <richard.vandorn@duke.edu>
In-Reply-To:  <48906348.8030700@duke.edu>
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Jul 30, 2008 at 8:49 AM, Richard Van Dorn <richard.vandorn@duke.edu>wrote:

> The only thing that distinguishes the outpatient from the inpatient > services is if the date of service falls between the date of admission > and the date of discharge. So in the prior example February 8th precedes > the admission to the hospital on February 9th. > > Sorry that the example wasn't as clear as it could have been. > > Thanks. > Richard > > <jamesgreen55@YAHOO.CA> >

Richard,

Since the DOA and DOD are numbers in SAS, they can be held in an array. A DOW does the work. There could be one or two admissions within a ID, so a 2-cell array is used but it can be modified to any number of admissions.

data need; do until(last.id); set have (where = (not missing(DOA))); by id; array st[2] _temporary_; array en[2] _temporary_; count + 1; st[count] = doa; en[count] = dod; end; do until(last.id); set have; by id; if st[1] le dos le en[1] then continue; else if st[2] le dos le en[2] then continue; else output; end; run;

This is one another way.

Regards,

Muthia Kachirayan


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