Date: Sun, 26 Jan 1997 06:58:15 -0500
Reply-To: kamal29@mail.idt.net
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Kamal Hijjazi <kamal29@MAIL.IDT.NET>
Organization: Simmons College
Subject: Conditional collapsing of observations
Content-Type: text/plain; charset=us-ascii
Hi friends:
I have some sort of a complicated programming problem. I have a file
with multiple observations per case; in which each observation represent
a Medicare claim that is submitted for payment (usually covering a
period of a month). In For each observation, there is:
1. Unique id number (baseid) for the case that the claim presents.
2. Begin: first date of claim coverage.
3. End: last date of claim coverage.
4. Vis: number of visits for that claim. (part of file is below)
I want to collapse the file into episodes of care. An episode of care is
defined here as a service period without interruption for over (30) days
(for the same baseid: lead(begin)-end <30 days). If 30 days lapse
between the end date and the begin date on the line, we have a new case.
So the collapsing is based on the variable (baseid) IF there was no
break in service for over 30 days.
For observations 1 and 2, they will be collapsed into 1 episode with
begin = 25NOV92 , end = 03DEC92 , and vis=6.
For obs=17-19, there are two episodes, the first starts on 10JUN92 and
ends on 06JUL92 with 7 visits. The second episode is limited to the
claim on obs=19.
For obs=24, there is only one claim.
Each case can have up to 12 claims.
OBS BASEID VIS BEGIN END
1 00000185 2 25NOV92 27NOV92
2 00000185 4 03DEC92 03DEC92
17 00002901 5 10JUN92 26JUN92
18 00002901 2 06JUL92 06JUL92
19 00002901 6 14SEP92 14SEP92
24 00003358 6 29JUN92 30JUN92
The goal is to get the file in this format:
OBS BASEID VIS BEGIN END
1 00000185 2 25NOV92 03DEC92
2 00002901 5 10JUN92 06JUL92
3 00002901 6 14SEP92 14SEP92
4 00003358 6 29JUN92 30JUN92
Your assistance is greatly appreciated.
Regards
Kamal Hijjazi Simmons College
Boston, MA 02115
(617)521-2121 Fax (617)521-3199