Statalist


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

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


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   Re: st: capturing full survival time with KM -sts graph-
Date   Mon, 12 Nov 2007 15:31:33 +0100

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: [email protected]
__________________________________________ 

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index