I have built a Cox proportional hazards model in SAS with a time-dependent covariate using proc Phreg and the coding process method.
I am interested in graphing the estimated hazard rate, but time-dependent covariates do not seem to be supported with the graphing options I can find. My outcome variable is coded as (start,stop)*death(0). I have previously used Proc lifetest for hazard graphs but cannot get it to run when the time variable is expressed in this way.
I would very much appreciate any suggestions, thank you
For some reason, PHREG will only plot cumulative hazards. This approach will get you a plot of the baseline hazard function.
First use the BASELINE statement in PHREG to get survivor function estimates, like so:
proc phreg data = yourdata;
model (start, end)*death(0) = ...;
baseline out = bl survival = s ... / method = pl;
run;
Then feed the output dataset into a macro called smooth
, written by Paul Allison, author of Survival Analysis Using SAS: A Practical Guide. The macro requires PROC IML which is licensed separately from base SAS, so if you don't have access to PROC IML then you can look at his code and adapt it using a series of data steps or what have you.
The macro can be found here. You may also want to consider rewriting the plotting portion to use an ODS graphics procedure like SGPLOT, but that's just personal preference.
Check out this related and informative UCLA page for more information regarding the use of the macro. Also useful is the SAS documentation for the BASELINE statement in PHREG.