window push version 9.0 window push *set scheme WDDtextbig window push set more on window push *sjlog using 7.9.1.Framingham.timeDepend, replace window push log using 7.9.1.Framingham.timeDepend.log, replace window push set memory 2m window push use C:\WDDtext\2.20.Framingham.dta, clear window push generate time= followup/365.25 window push *label variable time "Follow-up in Years" window push generate male = sex==1 window push label define male 0 "Women" 1 "Men" window push label values male male window push generate exitage = age+time window push stset exitage, enter(time age) failure(chdfate) window push more window push * window push * Perform hazard regression with time (age) dependent covariates for sex window push * window push generate exit = exitage window push stset exit, id(id) enter(time age) failure(chdfate) window push list id male age exit chdfate if id == 924 window push * window push * Split each patient's record into one or more records so that each window push * record describes one epoch with constant covariates for the epoch window push * window push stsplit enter, at(50 60 70 80) window push list id male enter exit chdfate if id == 924 window push replace enter=age if id~=id[_n-1] window push generate male1 = male*( exit <= 50) window push generate male2 = male*(enter >= 50 & exit <= 60) window push generate male3 = male*(enter >= 60 & exit <= 70) window push generate male4 = male*(enter >= 70 & exit <= 80) window push generate male5 = male*(enter >= 80) window push list id male? enter exit chdfate if id == 924 window push more window push stset exit, id(id) enter(time enter) failure(chdfate) window push stcox male? window push test male1 = male2 = male3 = male4 = male5 window push lincom male1 - male2 window push lincom male2 - male3 window push lincom male3 - male4 window push lincom male4 - male5 window push generate male34 = male3 + male4 window push summarize male34 window push stcox male1 male2 male34 male5 window push test male1 = male2 = male34 =male5 window push lincom male1 - male2 window push lincom male2 - male34 window push lincom male34 - male5 window push log close window push *sjlog close, noclean replace