* Researchers randomized 44 patients diagnosed with hepatitis and randomized them to prednisolone or placebo (TREAT) * time= the time in months from point of randomization to death or censoring * censor: 1= dead, 0=censored ; options nofmterr; libname paul "I:\BMTRY748\mulugeta\sas examples"; data hepa; input time censor treat; datalines; 2 1 1 6 1 1 12 1 1 54 1 1 56 0 1 68 1 1 89 1 1 96 1 1 96 1 1 125 0 1 128 0 1 131 0 1 140 0 1 141 0 1 143 1 1 145 0 1 146 1 1 148 0 1 162 0 1 168 1 1 173 0 1 181 0 1 2 1 0 3 1 0 4 1 0 7 1 0 10 1 0 22 1 0 28 1 0 29 1 0 32 1 0 37 1 0 40 1 0 41 1 0 54 1 0 61 1 0 63 1 0 71 1 0 127 0 0 140 0 0 146 0 0 158 0 0 167 0 0 182 0 0 ; run; proc format; value Rx 1='prednisolone' 0='control'; run; /*Plot KM curve*/ goptions reset=all; proc lifetest data=hepa plots=(s, ls) graphics censoredsymbol=none; time time*censor(0); title 'Kaplan-Meier plot of survivorship'; symbol v=none ; run; proc lifetest data= hepa plots=(s) graphics censoredsymbol=none; time time*censor(0); title 'cumulative hazard functions by group'; strata treat; format treat rx. ; run; quit; proc lifetest data=hepa plots=(s, ls, lls) graphics censoredsymbol=none; time time*censor(0); title 'cumulative hazard functions by group'; strata treat; format treat rx. ; run; quit; * parametric regression; proc lifereg data=hepa; model time*censor(0)= treat /dist=exponential; run; proc lifereg data=hepa; model time*censor(0)= treat /dist=weibull; run; proc lifereg data=hepa; model time*censor(0)= treat /dist=lnormal; run; *semi-parametric regression; proc phreg data=hepa; model time*censor(0)= treat; run; ** When there are ties ****; /**Do not specify ties**/ proc phreg data=hepa; model time*censor(0)=treat / risklimits; title 'Cox model -- ties'; run; /**Efron**/ proc phreg data=hepa; model time*censor(0)=treat / ties=efron risklimits; title 'Cox model—ties=efron'; run; /**Exact**/ proc phreg data=hepa; model time*censor(0)=treat / ties=exact risklimits; title 'Cox model —ties=exact'; run; /**Discrete**/ proc phreg data=hepa; model time*censor(0)=treat / ties=discrete risklimits; title 'Cox model —ties=discrete'; run;