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 (May 1999, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 22 May 1999 12:06:18 +0200
Reply-To:   Christian Schendera <cschende@IX.URZ.UNI-HEIDELBERG.DE>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Christian Schendera <cschende@IX.URZ.UNI-HEIDELBERG.DE>
Subject:   Q: How calculate the mean of a var for each day of the difference of two day dates
Content-Type:   multipart/mixed;

* Situation: I have a clinical data set that contains 3 resp. 5 date related variables, DOCUDAY (day of measurement), PATIN1 (day of first admission of person), PATOUT1 (day of first discharge of person, PATIN2 (day of second admission of person), PATOUT2 (day of first discharge of person. The difference of ech OUT-IN (STAYDAY1, STAYDAY2) adds up to total length of individual (PATID) stay of person (STAYDAY3). The only (!) dep.var. is SCOREDAY (below you find a sample of the data set). Until now everything is nice and easy. But here it comes.

* Aim of project: The aim of the project is to compare the values per 1st, 2nd, 3rd day of admission. The major problem of the project is that the tested persons were fluctuating during that clinical trial. Therefore they cannot get compared by the same day of month or measurement (see note below). A new var has to be calculated to enable results that say something like: 1. PATID=1's score on her first day of stay (d.o.s.) was xx, on her second d.o.s., etc., PATID=2's score on his first d.o.s. is...., etc.etc. 2. The mean of score of all persons on their 1.d.o.s. was xx, on the 2.d.o.s. was.....etc.etc. That's all. I tried some arrays and loops, but always encountered some malicious ghost in the machine. So here I am: How could I calculate the mean of the dep. var. for each day of the difference of day of admission and day of discharge?

Hints, solutions and wizards welcome! Chris

* Complete tested code you will find as attached documents. Run PIK4INSAS before PIK4STATSAS.

* 1. Sample of data set (tested): DOCUDAY VAR1 PATID PATIN1 VAR2 VAR3 PATOUT1 PATIN2 PATOUT2 VAR4 SCOREDAY etc.etc. etc. 02/02/99 9 59 15/01/99 08/02/99 3 . . . . 1 0 1 0 0 0 2 02/02/99 7 50 08/01/99 11/02/99 1 . . . . 2 0 0 1 0 0 2 02/02/99 7 57 13/01/99 . 0 . . . . 6 0 0 1 0 0 2 04/02/99 8 99 . . . . . . . 10 0 0 1 0 0 1 04/02/99 2 10 18/11/98 09/12/98 2 15/01/99 . . . 6 0 0 1 0 0 1 04/02/99 2 10 18/11/98 09/12/98 2 15/01/99 . . . 1 0 1 0 0 0 1 04/02/99 2 59 15/01/99 08/02/99 3 . . . . 1 0 1 0 0 0 2

* Note: To make the matter easier, you could leave out re-entry resp. re-discharge from proposals or just add them with the first lenghth of stay to a global score of stay. Code contains an alternatively solution provided by inestimably supporting Matthew Zack (Hey, thanks again Matthew !!).


PIK4INSAS.sas [application/x-sas]

PIK4STATSAS.sas [application/x-sas]


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