*! 2.0.0 21Aug97 Jeroen Weesie/ICS STB-41 ssa11 program define stcoxtvc version 5.0 st_is local varlist "ex opt none" local if "opt" local in "opt" local options "Check Eps(real 1E-6) Preserv noSHow STrata(str)" parse "`*'" * interface to stset * create t0/d/id if not specified st_aux, `show' * save for later restoration local id : char _dta[st_id] local t : char _dta[st_t] local t0 : char _dta[st_t0] local d : char _dta[st_d] local dta : char _dta[_dta] local wt : char _dta[st_wt] local wv : char _dta[st_wv] local sh : char _dta[st_show] * keep cases and variables if "`if'`in'" ~= "" { keep `if' `in' } if "`varlist'" ~= "" { keep `varlist' `id' `t' `t0' `d' `wv' `strata' } quietly compress * scratch tempvar event * form risk sets local n = _N if "`strata'" ~= "" { local st "strata(`strata')" } if "`preserv'" ~= "" { local p "nopreserv" } st_rpool `event', `st' `p' di _n in gr "number of episodes increased from " in ye `n' /* */ in gr " to " in ye _N * adapt t and t0 quietly { sort `event' `d' by `event' : replace `t' = `t'[_N] recast double `t0' replace `t0' = `t' - `eps' } * re-establish link to st-package char _dta[_dta] `dta' char _dta[st_t] `t' char _dta[st_t0] `t0' char _dta[st_d] `d' char _dta[st_id] `id' char _dta[st_wt] `wt' char _dta[st_wv] `wv' char _dta[st_show] `sh' if "`check'" ~= "" { stset } end