*! 1.0.0 15Feb97 (Jeroen Weesie/ICS) STB-41 ssa11 * in expanded format we need -id-, -d-, and -t0- program define st_aux version 5.0 local options "noSHow" parse "`*'" * interface to stset 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 w : char _dta[st_w] if "`id'" == "" { MakeVar "case identification (id)" id caseid CaseID st_id st_ID local id "$S_1" gen int `id' = _n label var `id' "st: case identifier" char _dta[st_id] `id' local newid 1 } if "`d'" == "" { MakeVar "failure variable (died)" died st_d st_died failure status local d "$S_1" gen byte `d' = 1 label var `d' "st: failure/censor identifier" char _dta[st_d] `d' local newd 1 } if "`t0'" == "" { MakeVar "entry times (t0)" t0 etime st_t0 local t0 "$S_1" gen byte `t0' = 0 label var `t0' "st: entry times" char _dta[st_t0] `t0' local newt0 1 } * if new variables are generated, display definitions if "`show'" == "" & "`newid'`newd'`newt0'" ~= "" { di _n in gr "st key variables were created" _n if "$S_FN" ~= "" { di in gr _col(4) "data set name: " in ye "$S_FN" } di _col(15) in gr "id: " in ye _c if "`newid'" ~= "" { di "`id'" _col(18) in gr "defined to _n: each record a unique subject" } else di "`id'" di _col(7) in gr "entry time: " in ye _c if "`newt0'" ~= "" { di in ye "`t0'" _col(18) in gr "defined to 0, meaning all entered at time 0" } else di "`t0'" di _col(8) in gr "exit time: " in ye "`t'" di _col(3) in gr "failure/censor: " in ye _c if "`newd'" ~= "" { di "`d'" _col(18) in gr "defined to 1, meaning all failed" } else di "`d'" if "`w'" ~= "" { di in gr _col(11) "weight: " in ye "`w'" } } else { st_show `show' } end * copied from stset (StataCorp) program define MakeVar /* opname */ local option "`1'" mac shift local list "`*'" while "`1'" ~= "" { capture confirm new var `1' if _rc == 0 { global S_1 "`1'" exit } mac shift } di in red "could not find variable name for `option'" di in red " tried: `list'" di in red " specify `option' explicitly" exit 110 end