** Clears the output and log windows and recalls the program; DM 'OUT;CLEAR;LOG;CLEAR;PGM;RECALL'; /* --------------------------------------------------------- program: PBC4.SAS input: pbc.dat DATA A does: Time dependent predictors in Cox regression and test for proportionality ------------------------------------------------------------ */; *Creates a macro var for location of project work; %LET PATH=A: ; OPTIONS PS=68 LS=120 PAGENO=1 NODATE NOCENTER ERRORS=3; * automatically prints the date and time on the footnote of output; FOOTNOTE "PBC4.SAS &SYSTIME &SYSDATE"; TITLE 'Time-Dependent Covariates'; * Designates file names to store the program, the output and the log; FILENAME PROGRAM "d:\bios180\PBC4.SAS"; FILENAME LOG "d:\bios180\PBC4.LOG"; FILENAME OUTPUT "d:\bios180\PBC4.OUT"; * Saves the program to above designated file; DM 'PGM; FILE PROGRAM REPLACE'; * Designates file name where data is stored; *LIBNAME DATA "&PATH\DISTRIB\"; *********************************************; DATA A; SET out.PBC; run; ***************************************************; * Now look at whether there is strong evidence that; * the relative risk comparing presence and absence ; * of hepatomegaly varies over time. *; ***************************************************; proc phreg data=A; model time*delta(0)=age hepa hepat; hepat=hepa*time; run; ********************************************************; * Questions: ; * ; * 1) Is it OK to fit time in an interaction term when * there is no main effect for it included? * Why or why not? ; * ; * 2) What is the RR for dying from PBC comparing presence * and absennce of hepatomegaly according to this * model? At 1000 days? At 2000 days? ; ********************************************************; * Now look to see if there is evidence of the non- * proportionality of the hazards for the presence and * absence of hepatomegaly in plots of the baseline ; * hazards for those two 'strata'. ; ********************************************************; title2 'Stratified Cox Regression for PBC data'; proc phreg data=A; model time*delta(0)=age; strata hepa; baseline out=B survival=s logsurv=ls loglogs=lls; run; *********** Set graphic control information; ** delete work graphics catalog from previous runs; proc greplay nofs igout=mygraphs; delete _all_; quit; proc greplay nofs igout=gseg2; delete _all_; quit; ********** ; filename Bios180 'd:/bios180/page292.eps'; goptions reset=( legend, pattern, symbol, footnote) device=psepsf gsfname=Bios180 gsfmode=replace rotate=landscape hsize=12 in vsize=10 in htext=3 pct ftext=swissb; title1 h=5 pct f=swiss "Stratified Cox Regression for PBC data"; title2 h=3.5 pct f=swissb 'Baseline Survival Function'; symbol1 c=BLUE v=CIRCLE i=steplj l=1; symbol2 c=RED v=TRIANGLE i=steplj l=1; legend1 position=( bottom left inside ) value=(t=1 "no hepatomegaly" t=2 "hepatomegaly") label=NONE ; axis1 label=none; proc gplot data=B gout=mygraphs ; plot s*time=hepa / legend = legend1 vaxis=axis1 noframe; run; proc greplay nofs igout=mygraphs; delete _all_; quit; proc greplay nofs igout=gseg2; delete _all_; quit; filename Bios180 'd:/bios180/page293.eps'; goptions reset=( legend, pattern, symbol, footnote) device=psepsf gsfname=Bios180 gsfmode=replace rotate=landscape hsize=12 in vsize=10 in htext=3 pct ftext=swissb; title2 h=3.5 pct f=swissb 'Log(Cumulative Hazard)'; symbol1 c=BLUE v=NONE i=steplj l=1; symbol2 c=RED v=NONE i=steplj l=3; legend1 position=( bottom right inside ) value=(t=1 "no hepatomegaly" t=2 "hepatomegaly") label=NONE ; proc gplot data=B gout=mygraphs ; plot lls*time=hepa / legend = legend1 vaxis=axis1 noframe; run; quit; /***************************************; ** Combine graphs on single pages ; GOPTIONS DEVICE=win ROTATE=LANDSCAPE HSIZE=10.67in VSIZE=8in; *GOPTIONS DEVICE=LXLP4037 HSIZE=11 VSIZE=8.5 ROTATE=LANDSCAPE; PROC GREPLAY NOFS GOUT=GSEG2; IGOUT=MYGRAPHS; TC = DATA.TEMPLATE; TEMPLATE=NEW2H; TREPLAY 1:GPLOT 2:GPLOT1; RUN; QUIT;*/ ** Automatically saves contents of the output and log windows; DM 'LOG; FILE LOG REPLACE'; DM 'OUT; FILE OUTPUT REPLACE';