Dear SAS users,
I would like to ask a question on the PHREG procedure. In my question, I will use an open dataset on bladder cancer (attached), where patients got recurrent events of cancer, and time from entry to the study to each of the cancers is known.
I apply marginal type of multiple events models to these data, that is, in the PHREG, I stratify the model by events type (enum variable). As usual for these type of models, I use robust variance estimation by adding ID statement (correlation within patient id).
proc phreg data=survival.bladder2 covs(aggregate);
model futime*status(0)=rx size number / ties=efron;
strata enum;
id id;
run;
With that code, the PHREG procedure provides an overall hazard ratio for treatment groups, but I would like to know how treatment affects the hazard of each of the events. I understand that I simply need to add an interaction term between rx (treatment) and enum (event type), but not sure how to do that. I tried just add rx*enum in the MODEL statement, but that isn’t correct (enum was treated as numerical, I think).
Would anyone be so kind to share how they would add a treatment by event interaction in this PHREG procedure?
Thank you!
Marina
You can indeed add an interaction term. This is also possible even when one of the terms is used as a stratification variable as it is in your case.
You should just specify that enum variable is a class variable. Otherwise, phreg will just make regression on the product.
proc phreg data=survival.bladder2 covs(aggregate); class enum rx/param=glm; model futime*status(0)=rx rx*enum size number / ties=efron; strata enum; id id; run;
And you can test the rx-effect is the same across the enum's by keeping in the main effect of rx. The test will come as in the table with type 3 tests.
proc phreg data=survival.bladder2 covs(aggregate); class enum rx/param=glm; model futime*status(0)=rx rx*enum size number / ties=efron; strata enum; id id; run;
Good luck
Put enum in a CLASS statement. If the only issue before was PHREG trying to fit enum as continuous, that should address the issue. The issue then becomes whether you get an appropriate analysis when enum is still considered as a stratification variable.
A shout out to @StatDave @JacobSimonsen or @FreelanceReinh for additional help in this area, since the above paragraph exhausts what I know about PHREG.
SteveDenham
You can indeed add an interaction term. This is also possible even when one of the terms is used as a stratification variable as it is in your case.
You should just specify that enum variable is a class variable. Otherwise, phreg will just make regression on the product.
proc phreg data=survival.bladder2 covs(aggregate); class enum rx/param=glm; model futime*status(0)=rx rx*enum size number / ties=efron; strata enum; id id; run;
And you can test the rx-effect is the same across the enum's by keeping in the main effect of rx. The test will come as in the table with type 3 tests.
proc phreg data=survival.bladder2 covs(aggregate); class enum rx/param=glm; model futime*status(0)=rx rx*enum size number / ties=efron; strata enum; id id; run;
Good luck
Dear @JacobSimonsen ,
Thank you for the answer! I see that my mistake was not including enum in the CLASS statement. I am going to try your solution!
I was only not sure why you add an option param=glm in the CLASS statement? Does it make a difference for an interaciton model?
Marina
Hi Maria,
It is not necessary to have the "param=glm" as an option in the class statement. You will get the same estimates whether or not you use that option.
I though think it is easier to see what the reference group is then the option is used, as that will give a row with 0s.
Btw, I made a typo. It was the intention not to include the main effect of rx in the first program.
Jacob
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.