BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cruise
Ammonite | Level 13

Below is my code. However, SAS Output has no information for HR and its 95%CI. What am I doing wrong here? Thanks in advance.

 

Hazard
Ratio
95% Hazard Ratio Confidence
Limits
proc import 
datafile="...\interaction.csv" out=cruise
dbms=csv replace;
getnames=yes;
run;

proc phreg data=help(where=(chemo ne 99 and stage ne 99));
class chemo (ref='5') stage (ref='2');            

model duration*vital_statusX(1)=chemo stage stage|chemo 
/rl selection=stepwise slentry=0.25 slstay=0.35 details;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
pau13rown
Lapis Lazuli | Level 10

there are a number of things you could do eg

-before the phreg code add "ods output parameterestimates=hr (keep=HAZARDRATIO HRLOWERCL HRUPPERCL);" see here: https://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#statug_phreg_sect0...,

-or use the hazardratio statement: https://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_phreg_sect0....

-or, it's possible that the interaction term falls out of the model because you are using a stepwise selection procedure, and thus it may not appear(?)

View solution in original post

10 REPLIES 10
pau13rown
Lapis Lazuli | Level 10

there are a number of things you could do eg

-before the phreg code add "ods output parameterestimates=hr (keep=HAZARDRATIO HRLOWERCL HRUPPERCL);" see here: https://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#statug_phreg_sect0...,

-or use the hazardratio statement: https://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_phreg_sect0....

-or, it's possible that the interaction term falls out of the model because you are using a stepwise selection procedure, and thus it may not appear(?)

Cruise
Ammonite | Level 13
trying your suggestions one at a time. Removing stepwise selection didn't lead to produce hazard ratio estimates. Now getting into the links to study.
Reeza
Super User

I downloaded your file and ran your code exactly as shown and got HR and confidence limits. You noticed that you're importing data and calling it CRUISE but then using a dataset named HELP in your code?

 


@Cruise wrote:
trying your suggestions one at a time. Removing stepwise selection didn't lead to produce hazard ratio estimates. Now getting into the links to study.

 

 

Reeza
Super User

My bad PROC PHREG does not calculate the HR because it's an interaction effect. This means that to consider chemo or stage if the interaction effect is significant you essentially need to set a level for each to get the hazard ratio. So when you have interaction terms you MUST use a HAZARDRATIO statement with the AT to calculate the HR. 

 

The earlier models have the HR but the last does not have the HR calculated. The table shows all the values as missing. My interpretation from your question was that no hazard ratio table was being presented. One is shown but has no values which is a different issue. 

 

 

 

Cruise
Ammonite | Level 13
Now I know hazardratio statement is required, I'm following this SUGi paper.
https://support.sas.com/resources/papers/proceedings10/253-2010.pdf
Cruise
Ammonite | Level 13

Hi,

Code below gave me Hazard Ratios for different combinations of chemos at different "stages". However, Hazard Ratio Estimates has all the values missing in the first table for "Analysis of Max Likelihood Estimates". Any idea how to calculate HRs for non-interaction terms as well @Reeza @pau13rown

 

proc phreg data=actualdata;
class chemo(ref='5') stage(ref='2') / param=ref order=internal;
model duration*vital_statusX(1)=chemo stage chemo*stage/ties=Efron;

hazardratio 'chemo comparisons at stage=1' chemo / diff=ref at (stage='1');
hazardratio 'chemo comparisons at stage=2' chemo / diff=ref at (stage='2');
hazardratio 'chemo comparisons at stage=3' chemo / diff=ref at (stage='3');
hazardratio 'chemo comparisons at stage=4' chemo / diff=ref at (stage='4');
run;

SAS Output

Analysis of Maximum Likelihood Estimates
Parameter     DF Parameter
Estimate
Standard
Error
Chi-Square Pr > ChiSq Hazard
Ratio
Label
chemo 1   1 -0.58488 0.06679 76.6870 <.0001 . chemo 1
chemo 2   1 -0.76999 0.06946 122.8931 <.0001 . chemo 2
chemo 3   1 -0.36383 0.07624 22.7723 <.0001 . chemo 3
chemo 4   1 -0.56654 0.04868 135.4679 <.0001 . chemo 4
chemo 99   1 -0.55819 0.06683 69.7661 <.0001 . chemo 99
stage 1   1 0.61075 0.21385 8.1564 0.0043 . stage 1
stage 3   1 0.55288 0.05532 99.9003 <.0001 . stage 3
stage 4   1 2.07708 0.05469 1442.4147 <.0001 . stage 4
stage 99   1 1.46554 0.07563 375.4676 <.0001 . stage 99
chemo*stage 1 1 1 0.15240 0.49794 0.0937 0.7596 . chemo 1 * stage 1
chemo*stage 1 3 1 -0.24116 0.07703 9.8010 0.0017 . chemo 1 * stage 3
chemo*stage 1 4 1 -0.43955 0.07787 31.8633 <.0001 . chemo 1 * stage 4
chemo*stage 1 99 1 -0.34137 0.13388 6.5018 0.0108 . chemo 1 * stage 99
chemo*stage 2 1 1 0.38167 0.43722 0.7620 0.3827 . chemo 2 * stage 1
chemo*stage 2 3 1 -0.30036 0.07728 15.1070 0.0001 . chemo 2 * stage 3
chemo*stage 2 4 1 -0.39476 0.07560 27.2679 <.0001 . chemo 2 * stage 4
chemo*stage 2 99 1 -0.10439 0.12572 0.6895 0.4063 . chemo 2 * stage 99
chemo*stage 3 1 1 0.11394 0.41748 0.0745 0.7849 . chemo 3 * stage 1
chemo*stage 3 3 1 -0.31936 0.08747 13.3311 0.0003 . chemo 3 * stage 3
chemo*stage 3 4 1 -0.64530 0.08719 54.7815 <.0001 . chemo 3 * stage 4
chemo*stage 3 99 1 -0.65144 0.13323 23.9088 <.0001 . chemo 3 * stage 99
chemo*stage 4 1 1 -0.91324 0.21560 17.9426 <.0001 . chemo 4 * stage 1
chemo*stage 4 3 1 0.24049 0.05769 17.3802 <.0001 . chemo 4 * stage 3
chemo*stage 4 4 1 0.32022 0.05720 31.3412 <.0001 . chemo 4 * stage 4
chemo*stage 4 99 1 -0.17206 0.07879 4.7694 0.0290 . chemo 4 * stage 99
chemo*stage 99 1 1 -0.95027 0.24051 15.6106 <.0001 . chemo 99 * stage 1
chemo*stage 99 3 1 0.03088 0.08554 0.1303 0.7181 . chemo 99 * stage 3
chemo*stage 99 4 1 -0.06898 0.08721 0.6256 0.4290 . chemo 99 * stage 4
chemo*stage 99 99 1 -1.37108 0.10444 172.3358 <.0001 . chemo 99 * stage 99

chemo comparisons at stage=1: Hazard Ratios for chemo
Description Point Estimate 95% Wald Confidence Limits
chemo 1 vs 5 At stage=1 0.649 0.247 1.707
chemo 2 vs 5 At stage=1 0.678 0.291 1.581
chemo 3 vs 5 At stage=1 0.779 0.348 1.741
chemo 4 vs 5 At stage=1 0.228 0.151 0.344
chemo 99 vs 5 At stage=1 0.221 0.141 0.348

chemo comparisons at stage=2: Hazard Ratios for chemo
Description Point Estimate 95% Wald Confidence Limits
chemo 1 vs 5 At stage=2 0.557 0.489 0.635
chemo 2 vs 5 At stage=2 0.463 0.404 0.531
chemo 3 vs 5 At stage=2 0.695 0.599 0.807
chemo 4 vs 5 At stage=2 0.567 0.516 0.624
chemo 99 vs 5 At stage=2 0.572 0.502 0.652

chemo comparisons at stage=3: Hazard Ratios for chemo
Description Point Estimate 95% Wald Confidence Limits
chemo 1 vs 5 At stage=3 0.438 0.406 0.472
chemo 2 vs 5 At stage=3 0.343 0.321 0.366
chemo 3 vs 5 At stage=3 0.505 0.464 0.549
chemo 4 vs 5 At stage=3 0.722 0.679 0.767
chemo 99 vs 5 At stage=3 0.590 0.532 0.655

chemo comparisons at stage=4: Hazard Ratios for chemo
Description Point Estimate 95% Wald Confidence Limits
chemo 1 vs 5 At stage=4 0.359 0.332 0.388
chemo 2 vs 5 At stage=4 0.312 0.294 0.331
chemo 3 vs 5 At stage=4 0.365 0.336 0.396
chemo 4 vs 5 At stage=4 0.782 0.737 0.829
chemo 99 vs 5 At stage=4 0.534 0.479 0.596
Reeza
Super User

You cannot get a individual estimate for chemo or stage because they interact so you have to use hazard ratio statements as well for any other HRs you want.

Cruise
Ammonite | Level 13

@Reeza

 

adding "hazardratio chemo" to my model results in with added exhausting table below. Please correct in my code directly. I know it's spoon feeding but I'm really panicking to be running out of time. I appreciate your help Reeza! All I need is hazard ratios with CI for each level of chemo (1,2,3,4).

 

ods trace on;
proc phreg data=cmydata(where=(KRAS ne 99));
class chemo(ref='5') stage(ref='2') 
	  surgery (ref='5') radiation(ref='2')
	  hormone (ref='3') immuno(ref='3')
	  sex(ref='2')/param=ref order=internal ;

model duration*vital_statusX(1)=chemo stage chemo*stage surgery 
      radiation hormone immuno sex/ties=Efron rl;
hazardratio chemo; 
hazardratio 'chemo comparisons at stage=1' chemo / diff=ref at (stage='1');
hazardratio 'chemo comparisons at stage=2' chemo / diff=ref at (stage='2');
hazardratio 'chemo comparisons at stage=3' chemo / diff=ref at (stage='3');
hazardratio 'chemo comparisons at stage=4' chemo / diff=ref at (stage='4');
run;
ods trace off; 

 

SAS Output

Hazard Ratios for chemo
Description Point Estimate 95% Wald Confidence Limits
chemo 1 vs 2 At stage=1 5.497 1.486 20.332
chemo 1 vs 3 At stage=1 1.025 0.315 3.332
chemo 1 vs 4 At stage=1 1.269 0.000 8.36E235
chemo 1 vs 5 At stage=1 1.715 0.569 5.171
chemo 1 vs 99 At stage=1 3.340 0.419 26.589
chemo 2 vs 3 At stage=1 0.186 0.042 0.834
chemo 2 vs 4 At stage=1 0.231 0.000 1.52E235
chemo 2 vs 5 At stage=1 0.312 0.074 1.313
chemo 2 vs 99 At stage=1 0.607 0.063 5.881
chemo 3 vs 4 At stage=1 1.238 0.000 8.16E235
chemo 3 vs 5 At stage=1 1.673 0.446 6.273
chemo 3 vs 99 At stage=1 3.258 0.361 29.396
chemo 4 vs 5 At stage=1 1.351 0.000 8.89E235
chemo 4 vs 99 At stage=1 2.632 0.000 1.74E236
chemo 5 vs 99 At stage=1 1.948 0.226 16.748
chemo 1 vs 2 At stage=2 5.497 1.486 20.332
chemo 1 vs 3 At stage=2 1.025 0.315 3.332
chemo 1 vs 4 At stage=2 1.982 0.968 4.060
chemo 1 vs 5 At stage=2 1.715 0.569 5.171
chemo 1 vs 99 At stage=2 3.340 0.419 26.589
chemo 2 vs 3 At stage=2 0.186 0.042 0.834
chemo 2 vs 4 At stage=2 0.361 0.112 1.158
chemo 2 vs 5 At stage=2 0.312 0.074 1.313
chemo 2 vs 99 At stage=2 0.607 0.063 5.881
chemo 3 vs 4 At stage=2 1.934 0.697 5.370
chemo 3 vs 5 At stage=2 1.673 0.446 6.273
chemo 3 vs 99 At stage=2 3.258 0.361 29.396
chemo 4 vs 5 At stage=2 0.865 0.342 2.185
chemo 4 vs 99 At stage=2 1.685 0.231 12.291
chemo 5 vs 99 At stage=2 1.948 0.226 16.748
chemo 1 vs 2 At stage=3 1.198 0.860 1.669
chemo 1 vs 3 At stage=3 0.730 0.431 1.235
chemo 1 vs 4 At stage=3 0.907 0.626 1.313
chemo 1 vs 5 At stage=3 0.600 0.390 0.924
chemo 1 vs 99 At stage=3 0.792 0.456 1.375
chemo 2 vs 3 At stage=3 0.609 0.382 0.973
chemo 2 vs 4 At stage=3 0.757 0.573 1.001
chemo 2 vs 5 At stage=3 0.501 0.351 0.715
chemo 2 vs 99 At stage=3 0.661 0.403 1.085
chemo 3 vs 4 At stage=3 1.242 0.757 2.039
chemo 3 vs 5 At stage=3 0.822 0.478 1.414
chemo 3 vs 99 At stage=3 1.085 0.571 2.062
chemo 4 vs 5 At stage=3 0.662 0.448 0.977
chemo 4 vs 99 At stage=3 0.873 0.519 1.469
chemo 5 vs 99 At stage=3 1.319 0.750 2.321
chemo 1 vs 2 At stage=4 1.262 1.026 1.551
chemo 1 vs 3 At stage=4 0.878 0.629 1.225
chemo 1 vs 4 At stage=4 0.525 0.404 0.684
chemo 1 vs 5 At stage=4 0.512 0.367 0.714
chemo 1 vs 99 At stage=4 1.055 0.658 1.692
chemo 2 vs 3 At stage=4 0.696 0.527 0.918
chemo 2 vs 4 At stage=4 0.416 0.345 0.503
chemo 2 vs 5 At stage=4 0.406 0.308 0.535
chemo 2 vs 99 At stage=4 0.836 0.541 1.292
chemo 3 vs 4 At stage=4 0.598 0.434 0.825
chemo 3 vs 5 At stage=4 0.583 0.399 0.852
chemo 3 vs 99 At stage=4 1.202 0.727 1.986
chemo 4 vs 5 At stage=4 0.975 0.708 1.342
chemo 4 vs 99 At stage=4 2.009 1.262 3.197
chemo 5 vs 99 At stage=4 2.061 1.243 3.417
chemo 1 vs 2 At stage=99 0.833 0.086 8.074
chemo 1 vs 3 At stage=99 79333.75 0.000 1.11E202
chemo 1 vs 4 At stage=99 1.948 0.233 16.283
chemo 1 vs 5 At stage=99 0.900 0.081 9.986
chemo 1 vs 99 At stage=99 84109.03 0.000 5.17E246
chemo 2 vs 3 At stage=99 95197.47 0.000 1.32E202
chemo 2 vs 4 At stage=99 2.338 0.584 9.363
chemo 2 vs 5 At stage=99 1.080 0.180 6.465
chemo 2 vs 99 At stage=99 100927.6 0.000 6.19E246
chemo 3 vs 4 At stage=99 0.000 0.000 3.41E192
chemo 3 vs 5 At stage=99 0.000 0.000 1.58E192
chemo 3 vs 99 At stage=99 1.060 0.000 .
chemo 4 vs 5 At stage=99 0.462 0.093 2.290
chemo 4 vs 99 At stage=99 43171.78 0.000 2.65E246
chemo 5 vs 99 At stage=99 93473.51 0.000 5.74E246
Reeza
Super User
Because you have an interaction term you cannot get a HR for CHEMO alone it's chemo at the different levels of stage which you already have above.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

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.

Discussion stats
  • 10 replies
  • 6805 views
  • 3 likes
  • 3 in conversation