Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: time-dependent covariates


From   "Jann, Ben" <ben.jann@soz.gess.ethz.ch>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: time-dependent covariates
Date   Fri, 5 Dec 2003 11:31:26 +0100

M. Khedr wrote:
> I have a data set similar to Stanford heart transplant
> data
> 
> 1. some patients on waiting list who did not receive a
> transplanted organ
> 
> 2. others received a transplanted organ
> 
> if we want to consider transplantation as a time
> dependent covariate " the risk of death before
> transplantation is deferent form the risk after
> transplantation". knowing that we have 
> 
> Listing date
> Transplantation date
> Last seen date
> 
> and one record per patient
> 
> how to generate a time dependent covariate in this
> case.

Use -stsplit- to split the records at transplantation date 
(after you have properly -stset- your data):

 . stsplit transplant, after(transplantdate) at(0)

(assuming that 'transplantdate' is in the same units as the timevar in
-stset- and transplantdate==. for cases without transplantation) 
 
The new variable 'transplant' will equal -1 before transplantation and 0
thereafter. So you might want to recode:

 . replace transplant=transplant+1

I hope this works.

ben

PS: Also see -stsplit- in the ST-manual (Example 3 on p. 337). The
approach presented there is, however, much more complicated.


*
*   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