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 (July 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 23 Jul 2003 13:39:32 -0400
Reply-To:   Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:   Re: Computing time ill with overlapping episodes
Comments:   To: "Cacialli, Doug" <Doug_Cacialli@URMC.ROCHESTER.EDU>
Content-Type:   text/plain


First it would be best to make some simple sample data.

data w ; input id begdt :date9. enddt :date9. ; format bdgdt enddt date9. ; cards ; 1 1jan2001 5feb2002 1 7may2001 6jun2002 1 9may2001 12dec2001 1 1sep2002 1nov2002 ;

Then I would recognize the significance of sorting by the begin points as shown in the comment in the step below. Then turn it into code.

data w2 ( keep = id days ) ; retain days dt1 dt2 ; set w ; by id begdt ;

if then do ; dt1 = begdt ; dt2 = enddt ; end ;

/* 3 possible relationships for two intervals given that they were sorted so that dt1 <= begdt */ if dt2 < begdt then do ; /* start new interval */ days + ( dt2 - dt1 + 1 ) ; put days= ( dt1 dt2 ) ( =date9. +1 ) ; dt1 = begdt ; dt2 = enddt ; end ; else /* extend interval */ if begdt <= dt2 <= enddt then dt2 = enddt ; else if enddt <= dt2 then ; /* skip */ else error ;

if ; days + ( dt2 - dt1 + 1 ) ; put days= ( dt1 dt2 ) ( =date9. +1 ) ; put "total " days = ; run ;

Finally put it into context of the real data. (LTR) -----Original Message----- From: Cacialli, Doug [mailto:Doug_Cacialli@URMC.ROCHESTER.EDU] Sent: Wednesday, July 23, 2003 12:41 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Computing time ill with overlapping episodes

I've recently been given the task of computing cumulative time ill for a group of individuals with a variety of psychiatric diagnoses. In this, our second round of analyses, we're interested in defining 'cumulative time ill' as the total number of weeks an individual is diagnosed with any affective disorder (i.e., major depression, minor depression, dysthymic disorder, etc.).

Unfortunately, it's not uncommon for individuals to have multiple, overlapping diagnoses. For example, an individual with a diagnosis of both major depression AND dysthymic disorder for the entire year of 2000 is ill, cumulatively, for 52 weeks. My first run at this had cumulative time ill coming back as 104 weeks.

I'm just about finished with a macro that will allow us to specify as many diagnoses as we desire, as well as start and end dates as date constants OR variables containing dates. I'm wondering what approach people have taken in the past to address this type of problem. I'm assuming issues similar to this would be common in certain clinical trials research. I'd be willing to share my finished code with anyone who's interested.

Thanks for any help.

Doug out.

------------------------------------------- Doug Cacialli - Data Manager / Data Analyst Sleep and Depression Research Laboratory University of Rochester Medical Center 300 Crittenden Boulevard - Box PSYCH Rochester, New York 14642 Phone: (585)273-3309 Fax: (585)506-0287 -------------------------------------------

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