Estimating and Testing Cause Specific Hazard Ratio Using SAS
Objective
In this document we present how to estimate and test cause specific hazard ratio for the probability of experiencing a certain event at a given time in a competing risks model in SAS (version 9.4). We focus on the basic model where each subject experiences only one out of k possible events as depicted in the figure below.
As this document aims to provide syntax for estimating and testing cause-specific hazard ratios using Cox’s PH model for competing risks, we assume that readers have working knowledge of a competing risks framework. The Reference below list a few literature for a quick refresher on this topic.
The syntax given here produce results match that by R package survival
, in particular with function coxph()
(see the companion R document). This is usually necessary if validating results from the two software is the objective.
SAS procedure
We use PROC PHREG
in this document.
Data used
The bone marrow transplant (BTM) dataset as presented by Guo & So (2018) is used. The dataset has the following variables:
Group
has three levels, indicating three disease groups.T
is the disease-free survival time in days. A derived variableTYears = T/365.25
is used in the analysis.Status
has value 0 ifT
is censored; 1 ifT
is time to relapse; 2 ifT
is time to death.WaitTime
is the waiting time to transplant in days.For illustration, a categorical variable
waitCat
is created fromwaitTime
aswaitCat = TRUE
ifwaitTime > 200
, andFALSE
otherwise.
proc format;1='ALL'
value DiseaseGroup 2='AML-Low Risk'
3='AML-High Risk';
0='Censored'
value EventStatus 1='Relapse'
2='Death';
run;"..\data";
libname datalib
data bmt;
set datalib.bmt;= T / 365.25;
TYears = (waitTime>200);
waitCat = _n_;
ID
format Group DiseaseGroup.;
format Status EventStatus.; run;
Estimating and testing the cause specific hazard ratio
Syntax 1: all events in one go
Starting in SAS/STAT 14.3, all competing events can be estimated together. However, currently this syntax does not allow the strata
statement.
=Bmt;
proc phreg data'Cause-Specific Hazard Regression for Relapse and Death without strata';
title Group (order=internal ref=first);
class *Status(0)=Group / eventcode(cox)=1;
model T run;
The results for both events are given below:
Three points to note:
The option
eventcode(cox)=1
tells PHREG thatRelapse
(event 1) is the event of interest, andDeath
(event 2) is the competing risk.This results are essentially the same as modeling
Relapse
andDeath
separately: there are two global hypotheses, one for each event.This is different from fitting all events in one model that is done in R
coxph()
. In other words, this is entirely a different model from what R does when modeling all competing events together. (See Syntax 1 in the Companion R document.)Additionally, since
strata
statement cannot be incorporated, the results for each event are different from that produced by Syntax 1 in the R document.
For more information, please see Guo C and So Y. (2018).
Syntax 2: Estimating one event at a time
We use Relapse
as an example.
=p1;
ods output ParameterEstimates=bmt;
proc phreg data'Cause-Specific Hazard Regression for Relapse with strata';
title Group (order=internal ref=first) waitCat;
class
strata waitCat;*Status(0,2) = Group / risklimits alpha = 0.05;
model TYears
run; quit;
The results for event Relapse
are given below:
Note that if there is no stratification, the results will be the same as from Syntax 1 above but for Relapse
only.
Summary
In
PROC PHREG
, by default Breslow’s method is used for handling ties. To match the default results with Rsurvival::coxph()
which uses Efron’s method, this needs to be requested viaties = efron
option in themodel
statement.For multi-state models such as a competing risk analysis, the R function
survival::coxph()
by default estimate the standard errors of parameter estimates with a robust sandwich estimator. To match results with R, the optioncovsandwich
orcovs
for short, need to be added to theproc phreg
statement.Due to the different internal numerical estimation methods of R and SAS, results only match up to the 4th decimal places. However, overall consistency can be established between the two for estimating and testing cause-specific hazard ratio using Cox’s PH model.
Reference
Guo C and So Y. (2018). “Cause-specific analysis of competing risks using the PHREG procedure.” In Proceedings of the SAS Global Forum 2018 Conference. Cary, NC: SAS Institute Inc. https://support.sas.com/resources/papers/proceedings18/2159-2018.pdf
Pintilie M. (2006). Competing Risks: A Practical Perspective. Wiley. http://dx.doi.org/10.1002/9780470870709
Therneau T, Crowson C, and Atkinson E. (2024). “Multi-state models and competing risks.” https://cran.r-project.org/web/packages/survival/vignettes/compete.pdf