Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: kaplan meier plots

 From Maarten Buis To statalist@hsphsun2.harvard.edu Subject Re: st: kaplan meier plots Date Thu, 22 Dec 2011 14:40:59 +0100

```There are several ways of doing this. I would do this as follows:

say that the study ended January 20th 2011

gen age = dod - dob
gen byte died = dod < mdy(1,20,2011)
stset age, died(died) scale(365.25)

So, age would be age in days. This is turned into age in years with
the -scale()- option. The variable died contains a 1 if the person
died before the study ended and is 0 when the person was still alive
when the study ended.

Hope this helps,
Maarten

On Thu, Dec 22, 2011 at 2:10 PM, Lars Folkestad wrote:
> I have a question regarding the kaplan-meier plots
>
> I want to investigate the lifespan in patients with a given disease.
>
> I have the following data
>
> Date of birth: DMY
> Date of death: DMY
>
> When i use the following:
>
> . Stset DOB, faliure(DOD)
>
> I get at table saying:
> obs. time interval:  (0, DOB]
>
> _N obs. end on or before enter()
>
> Im guessing the program is working with the stata start time of 0.
>
> How do i set the start time to the DOB?
>
>
> And while we're at it, before i noticed the error i did draw up a KM plot
> and found that it gave me an analysis time of 1500000 or somewhere in that
> ball park. I would love for it to be years.
>
>
> Anythoughts?
>
> Thank you
>
> lars
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

--
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```