Date: Tue, 11 Jan 2000 14:24:30 -0000
Reply-To: Keith Branton <kdb@GLOBALNET.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Keith Branton <kdb@GLOBALNET.CO.UK>
Organization: GXSN
Subject: Re: Calculating person years for cohort study (epidemiological)
Something like...
data <out>;*substitute the name of the dataset you want to produce;
set <in>;*substitute the name of tha dataset contaning the data;
array a_test(8) test91-test99; *put variables in an array;
array a_date(8) date91-date99;
if test='N' then begin; *check that they were Negative at the start of the
cohort;
do i=1 to 7 while (a_test(i)='N'); *work out when they were first
reported as not negative;
end;
years=round((a_date(i)-'1jan1990'd)/365.25,0.1);*calculate approximate
years from 1 jan 1990 to one decimal place;
end;
else years=0;
drop i;
run;
...would probably get you most of the way. Unfortunately I can't test the
code as I don't have access to SAS. Hope this helps.
Keith.
<lcoetzee@my-deja.com> wrote in message news:85fagv$15s$1@nnrp1.deja.com...
> 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.
|