Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: data prep for survival analysis with time varying covariate

From   Kyleigh Schraeder <>
Subject   st: data prep for survival analysis with time varying covariate
Date   Wed, 18 Jan 2012 18:19:37 -0500

Hi Dr. Gagnon,

This is the first time I'm using a survival analysis so I hope my
questions make sense.

My variables are: id, timetoevent (in days), event, and waittime.

In my study, every patient has their own start time or time 0.  At
time 0, each patient is put on a wait-list.  Some patients may still
be waiting when the 'event' happens (they should be censored).
However, some patients may come off of the wait list and receive
services.  Thus, some patients are technically 'not waiting' for a
period of time before the event occurs.  So, as I understand,
'waittime' is a time-varying covariate.

I am interested in examining the effect of a patient's wait-time on
the outcome (whether the event occurs). In other words, what is the
probability of the event occuring for patient X, given their waiting
time. Right now my data is currently set up where each participant has
their own row of data.

ID      Timetoevent     Event   Waittime
1       50                      0       40
2       73                      0       8
3       150                    1       100

I'm not sure how to best arrange the data in STATA since I'm confused
as to how to put this data in the wide-person format since I don't
have an Event1, Event2, Event3 or a Wait1 Wait2 Wait3..  I have tried
creating a vector using loop commands (to give me an Event1 Event2
Event3) but I need to specify the number of variables I create (max
390 days of observation) and this is different for each patient..

Any help or steps in the right direction would be appreciated! Thank you

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index