Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: capturing full survival time with KM -sts graph-


From   "Allen Buxton" <ABUXTON@childrensoncologygroup.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: capturing full survival time with KM -sts graph-
Date   Mon, 12 Nov 2007 14:29:02 -0800

You might be interested in 'survtime' to help process dates.

ssc desc survtime


====
version 9
       clear
       input id str9 ddx str9  ddied str9 dlost str9 stend
              5   01may1992           .           .   31oct1997
              8   01sep1991   01sep1996           .   31oct1997
             22   01jun1991           .           .   31oct1997
             33   01jan1989           .   01jan1996   31oct1997
       end

       generate datedx = date(ddx,"dmy")
       generate datedied = date(ddied,"dmy")
       generate datelost = date(dlost,"dmy")
       generate studyend = date(stend,"dmy")

survtime , ev( datedied) cen( datelost studyend) seq
list
stset event_d, failure(event_i==1) origin(datedx) scale(30.4375)
list id _t event_i event_d
====


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Maarten buis
Sent: Monday, November 12, 2007 6:51 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: capturing full survival time with KM -sts graph- 

For more on data preparation for survival analysis see lesson 3 in
Stephen Jenkins' series of lectures on survival analysis:
http://www.iser.essex.ac.uk/teaching/degree/stephenj/ec968/

-- Maarten

--- Svend Juul <SJ@SOCI.AU.DK> wrote:
> Michael McCulloch wrote:
> 
> I'm applying -sts graph- to a set of survival data, in which study 
> ends at 10 years. However, the Kaplan Meier plot I create doesn't 
> reflect people who survived till study's end.
> 
> Below are sample data, prepared with
> 	. stset datedied, failure(failed) origin(datedx) scale(30.4375)
> 
>       id   datedx       datedied    datelost    studyend   _t 
>        5   01may1992           .           .   31oct1997    . 
>        8   01sep1991   01sep1996           .   31oct1997   60 
>       22   01jun1991           .           .   31oct1997    . 
>       33   01jan1989           .   01jan1996   31oct1997    .
> 
> The following command will not show the subjects who survived till 
> study's end:
> 	. sts graph
> 
> Note that _t correctly shows 60 month survival for:
> 	subject #8, who lived 5 years
> 
> However, note that _t shows no survival time for:
> 	subjects #5 and #22, who were still alive at study end
> 	 subject #33, who lived 7 years.
> 
> I don't want to simply replace _t with the date calculation 
> "datelost-datedx", because _t for those censored subjects will be lost

> if I again -stset-.
> 
> I also don't want to simply replace datedied with studyend, because 
> those subjects censored at study end will look like they'd died on the

> KM plot.
> 
> How is a situation like this handled?
> 
> ------------------------------------------------------------------
> 
> You need one variable containing the time at observarion end (death or
> censoring) and a dichtomous event variable. Here is an example:
> 
>        clear
>        input id str9 ddx str9  ddied str9 dlost str9 stend
>               5   01may1992           .           .   31oct1997
>               8   01sep1991   01sep1996           .   31oct1997
>              22   01jun1991           .           .   31oct1997
>              33   01jan1989           .   01jan1996   31oct1997
>        end
> 
>        version 9  // Date functions and formats are different in Stata

> 10
> 
>        generate datedx = date(ddx,"dmy")
>        generate datedied = date(ddied,"dmy")
>        generate datelost = date(dlost,"dmy")
>        generate studyend = date(stend,"dmy")
>        egen enddate=rowmin(datedied-studyend)
>        format datedx-enddate %d
>        generate risktime=enddate-datedx
> 
>        generate died=0
>        replace died=1 if datedied<.
> 
>        //  or:  generate died = datedied<.
> 
>        stset risktime, failure(died==1) id(id)
> 
>        sts list
> 
> Hope this helps
> Svend
> 
> 
> __________________________________________
> 
> Svend Juul
> Institut for Folkesundhed, Afdeling for Epidemiologi (Institute of 
> Public Health, Department of Epidemiology) Vennelyst Boulevard 6 
> DK-8000  Aarhus C, Denmark
> Phone: +45 8942 6090
> Home:  +45 8693 7796
> Email: sj@soci.au.dk
> __________________________________________
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try
it now.
http://uk.answers.yahoo.com/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index