filename grafout 'l08.ps'; goptions device=pslmono gsfname=grafout gsfmode=append; options ls=72; /***********************************************************/ /* Data excerpted from NIH Multi Center AIDS Cohort Study. */ /* Cohort consists of gay and bisexual men. Variables are */ /* happy: self-reported level of happiness at enrollment */ /* time: time to death or loss to followup, */ /* entry: age at first follow-up, status: 1 for death, 0 ow*/ /* life: finer self-reported happiness measure */ /* aaids: age at development of aids. */ /***********************************************************/ data mcac; infile 'mcac.dat'; input borny life happy status entry time aaids; run; proc phreg data=mcac; model time*status(0)=; baseline out=base1 survival=s1; run; proc phreg data=mcac; model time*status(0)=/entry=entry; baseline out=base2 survival=s2; run; data base; merge base1 base2; by time; label s1='Survival ignoring left truncation'; label s2='Survival accounting for left truncation'; run; axis1 label=('Time' ); axis2 label=(a=90 'Survival' ); proc gplot data=base; plot s1*time s2*time/overlay legend haxis=axis1 vaxis=axis2; symbol1 i=stepjl line=1; symbol2 i=stepjl line=2; run; proc phreg data=mcac; model time*status(0)=happy/entry=entry; run; proc phreg data=mcac; model (entry,time)*status(0)=happy;run; /***********************************************************/ /* Data from http://lib.stat.cmu.edu/datasets/csb, Case */ /* Studies in Biometry, ch. 14, Interpretation of a */ /* Leukemia Trial Stopped Early, Emerson, et al. */ /* Variables are age, treatment arm (0 for D or 1 for I) */ /* indicator for remission and time of remission, */ /* indicator of transplant and time of transplant, time to */ /* end of study and indicator of death, fab (a measure of */ /* disease status, -1=>missing), gender(1=M,0=F), white */ /* blood count (-1=>missing), kscore (a measure of disease */ /* status), and chemotherapy rounds before remission ) */ /***********************************************************/ data emerson ; infile 'emerson.dat' ; input age ttt crind crtime transs transp time status fab gender wbc kscore chem; if fab=-1 then fab=.; if wbc=-1 then wbc=.; wbcl=0; if wbc<13.5 then wbcl=1; run; title1 'Modeling time to death'; proc phreg data=emerson ; title2 'Fixed-covariate Cox regression'; model time*status(0)=ttt; run; proc phreg data=emerson ; title3 'Fixed-covariate Cox regression'; title2 'Incorrect use of transplant status'; model time*status(0)=ttt transs; run; proc phreg data=emerson nosummary; title1 'Modeling time to transplant'; title2 'Checking whether treatment influenced transplant'; model transp*transs(0)=ttt; run; title1 'Modeling time to death'; proc phreg data=emerson nosummary; model time*status(0)=ttt transi; title2 'Checking influence of transplant'; title3 'Adding Transplant as Time-dependent covariate'; transi=0; if time>transp then transi=1; run; proc phreg data=emerson nosummary; model time*status(0)=ttt cri; title2 'Adding remission as time-dependent'; cri=0; if time>crtime then cri=1; run; proc phreg data=emerson nosummary; model time*status(0)=ttt cri crt; title2 'Checking proportional hazards for remission'; title3 'Adding more complicated time-dependent covariate'; cri=0; if time>crtime then cri=1; crt=cri*(time-crtime); run; proc phreg data=emerson nosummary; title2 'Adding age as fixed covariate'; model time*status(0)=ttt transi age; transi=0; if time>transp then transi=1; run; proc phreg data=emerson nosummary; title2 'Adding age as time--dependent covariate'; title3 'Effect is the same as for fixed version'; model time*status(0)=ttt transi fage; transi=0; if time>transp then transi=1; fage=age+time/365.25; run; title1 'Modeling time to remission'; proc phreg data=emerson nosummary; model crtime*crind(0)=ttt wbcl diagn; diagn=time*wbcl; run; proc sort data=emerson; by wbcl; run; proc phreg data=emerson nosummary; title2 'Stratifying on wbc'; model crtime*crind(0)=ttt; strata wbcl; run; proc phreg data=emerson nosummary; title2 'By wbc'; model crtime*crind(0)=ttt; by wbcl; run; proc phreg data=emerson nosummary; title2 'wbcl as covariate'; model crtime*crind(0)=ttt wbcl; run;