I'm trying to fit a model with covariates sex, age, totchol and
allow for smoking status to change at each visit.
My variables are the following:
randid- patient id
time2- Start time of period 2 (years)
time3- Start time of period 3 (years)
sex- (1=Male, 2=Female)
age- Age at baseline (years)
cursmoke1- Smoking status at start of period 1 (0=No,1=Yes)
cursmoke2- Smoking status at start of period 2 (0=No,1=Yes)
cursmoke3- Smoking status at start of period 3 (0=No,1=Yes)
totchol- Total Cholesterol (mg/dL) at baseline
cvd- Cardiovascular (CVD) event occurred (0=censored,1=yes)
timecvd- Time of CVD event (years)
I'm interested in time to cardiovascular event.
I'm new to Stata and am not sure the following code is appropriate. I'd appreciate any suggestions.
stset timecvd, failure(cvd) id(randid)
stsplit, at(failures)
gen cs=cursmoke3
replace cs=cursmoke2 if _t<2
replace cs= cursmoke2 if _t<1
stcox i.cs i.sex age totchol, nolog
0 Response to Using stsplit
Post a Comment