|
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
|