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

From |
"Claus Dethlefsen / Aalborg Sygehus" <aas.claus.dethlefsen@nja.dk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: stcox and tvc. Translation of SAS program |

Date |
Mon, 13 Jun 2005 13:50:44 +0200 |

Dear list I have difficulties translating a SAS program into Stata. I am fairly new to Stata, and also to survival analysis, but hope that I can get some help from the list. The situation from survival analysis. Events are registred in the binary variable hd, and time-to-event in the continuous variable year. The variables age1, age2, gender, c1 and c2 are binary variables. The variable case is also binary. This is the SAS program: proc phreg data = test2; model year*hd(0) = i1 i2 i3 age1 age2 gender c1 c2/risklimits ; if year<1 and case=0 then i1=1;else i1=0; if 1<=year<=2 and case=0 then i2=1;else i2=0; if year>2 and case=0 then i3=1;else i3=0; ods output parameterestimates = oddsm; run; As I interpret this, the baseline hazard rates are different in the three intervals defined by i1 i2 and i3, adjusted for the remaining covariates. These are my Stata attempts: /* Common to the code below */ gen i1=0 replace i1=1 if (year<1&case==0) gen i2=0 replace i2=1 if (year>=1&year<=2&case==0) gen i3=0 replace i3=1 if (year>2&case==0) /* Attempt 1 */ stset year, failure(hd==1) /* note that SAS has the opposite hd==0 */ stcox i1 i2 i3 age1 age2 gender c1 c2 This does not work, since the SAS code implies different baseline hazards in the three periods defined by inter1-3. /* Attempt 2 */ stset year, failure(hd==1) stcox i1 i2 i3 age1 age2 gender c1 c2, tvc(i1 i2 i3) or stcox age1 age2 gender c1 c2, tvc(i1 i2 i3) I am not certain whether my use of tvc() is correct (and equivalent to the SAS approach). At least, the estimates are very different. /* Attempt 3 */ gen id=_n stset year, failure(hd==1) id(id) stcox i1 i2 i3 age1 age2 gender c1 c2 or stcox i1 i2 i3 age1 age2 gender c1 c2, tvc(i1 i2 i3) None of the attempts produce estimates anywhere near the output from SAS. I am probably missing some options or have misunderstood their use. I would appreciate help to get on. I am using the latest Stata 9, updated to the most recent version. Best, Claus _______________________________ Claus Dethlefsen, Msc, PhD Statistiker ved Kardiovaskulært Forskningscenter Klinisk Epidemiologisk Afdeling Aalborg Sygehus Nord Stengade 10, 2. sal 9000 Aalborg Tlf: 9932 1086 9932 1094 (direkte) Fax: 9932 1088 email: aas.claus.dethlefsen@nja.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/

- Prev by Date:
**Re: st: Reading the letters in a name up to a particularcharacter in Stata 8.2** - Next by Date:
**Re: st: Reading the letters in a name up to a particular character in Stata 8.2** - Previous by thread:
**Re: st: Reading the letters in a name up to a particularcharacter in Stata 8.2** - Next by thread:
**st: default version of abbrev(n) for list?** - Index(es):

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