```Date: Tue, 11 Jan 2000 15:48:29 +0100 Reply-To: detecsm_hellriegelg@WESTLB.DE Sender: "SAS(r) Discussion" From: Gehard Hellriegel Subject: Re: Calculating person years for cohort study (epidemiological) Content-type: text/plain; charset=us-ascii Hi, the following code should do it, but I'm not sure, what the 3.9 means! 3 years and 9 months? What do you want to do with that number? Is 3 years 11 months bigger, more, longer? For sure, but 3.11 is less than 3.9! I'd think, month(maxdat)/12*10 would be a better value, if you want to do calculations with it. Also I'd use month(...)-1 to avoid problems with month=12. That would return a kind of "distance" (in Jan of the following year it is 1.0, in Feb 1.1, ...). All in all the peace would be: ....!!put((month(maxdat)-1)/12*10,..... data test; infile "test.dat" missover; length date91-date99 8 test91-test99 \$1; input test \$ test91 \$ date91:mmddyy10. test92 \$ date92:mmddyy10. test93 \$ date93:mmddyy10. test94 \$ date94:mmddyy10.; format date91-date99 mmddyy10.; run; data tn; set test; mindat="01jan1990"d; maxdat=max(date91,date92,date93,date94,date95,date96,date97,date98,date99); dif=input(compress(put(year(maxdat)-year(mindat),2.)!!"."!!put(month(maxdat),2.)),8.2); format mindat maxdat mmddyy10.; run; lcoetzee@MY-DEJA.COM on 11.01.2000 14:17:30 Bitte antworten an lcoetzee@MY-DEJA.COM An: SAS-L@LISTSERV.UGA.EDU Kopie: (Blindkopie: DeTeCSM HellriegelG/D/ExternalStaff/WLB) Thema: Calculating person years for cohort study (epidemiological) I have data from a 9 year cohort on people with/without a certain disease. Everyboy was tested in January 1990 and after that any time of the year annually. They can reamain negative (N) throughout the follow-up or become positive (T) at any time, after which they are not part of the study anymore. They can also be discharged or die etc. for which there are a number of codes. My data look something like this: test test91 date91 test92 date92 test93 date93 test94 date94 etc. N N 08/13/91 N 06/20/92 B 09/21/93 N N 07/29/91 T 08/19/92 A person can who was tested N for the whole study, therefore contributed 9 years to the study, whereas for example the first case in the above dummy table would have contributed 3.9 years because he was discharged in September 1993 and the second case would have contributed 2.8 years as he was tested positive in August 1992 and was not followed up after that. Would like to have a new variable containing these figures to be able to add them up and use that figure to calculate incidence rates. This is quite urgent as I have 4 large cohorts running (this one has 2093 observations) and it is a bit much to work out by hand Thanks Lizet Coetzee lcoetzee@my-deja.com lcoetzee@ncoh.pwv.gov.za Sent via Deja.com http://www.deja.com/ Before you buy. Mit freundlichen Gruessen DeTeCSM, Gerhard Hellriegel WestLB Abteilung: 001-80622 Aderstr. 22 D - 40217 Duesseldorf Tel.: +49211 826 6173 Fax: +49211 826 5393 ```

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