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

Hi,

 

I am using PROC PHREG to estimate the hazards ratio of death in a multivariable model with one continuous variable of particular interest. I would like to plot hazards ratio by this variable. This question has been asked here before, but it was not answered clearly. The problem does not lie in plotting the hazards ratio but rather in exporting this for each value of the variable of interest. I tried several statements in PROC PHREG and didn't come to my wish. Very simplified my model looks like this:

 

 proc phreg data=mydata;
	strata var1;
	class var2 var3;
	model Time*censor(0) = ContinousVar var2 var3;
run;

This is the plot I am trying to generate. As you can see I need the hazards ratio by different values of the variable of interest as well as the confidence interval.

 

AzAzC

 

I would appreciate any help.

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
pau13rown
Lapis Lazuli | Level 10

but once you have the model estimates you can just calculate the HR for any range of values of the continuous variable ie do it in a data step rather than exporting from phreg

 

edit, something like:

ods output parameterestimates=out (keep=estimate parameter where=(parameter="xxxxx"));
proc phreg data=xxxxx;
  class aaa bbb ccc;
  model surv*cens(1)= ...../ rl alpha=0.05;
run;

data .....;
  set out;
  do x=.... to .... by ....;
    val=exp(estimate*x);
    output;
  end;
run;

 

??

View solution in original post

4 REPLIES 4
pau13rown
Lapis Lazuli | Level 10

but once you have the model estimates you can just calculate the HR for any range of values of the continuous variable ie do it in a data step rather than exporting from phreg

 

edit, something like:

ods output parameterestimates=out (keep=estimate parameter where=(parameter="xxxxx"));
proc phreg data=xxxxx;
  class aaa bbb ccc;
  model surv*cens(1)= ...../ rl alpha=0.05;
run;

data .....;
  set out;
  do x=.... to .... by ....;
    val=exp(estimate*x);
    output;
  end;
run;

 

??

Ubai
Quartz | Level 8

Thanks @pau13rown, but is this the way to do it when the relationship is non-linear as well?

pau13rown
Lapis Lazuli | Level 10

i would think so, ie write the model out as it should be in the data step (with any nonlinear terms) and then see if the plot makes sense. Eg these authors found "a significant nonlinear relationship with regard to the composite of death/HF hospitalization (P = 0.0039), with a plateau of effect beyond 180 ms for the composite outcome" [https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3855551/] and this is seen in the plot: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3855551/figure/EHT290F3/?report=objectonly

 

it is a shame that authors don't routinely make programming code available on publication

Ubai
Quartz | Level 8

@pau13rown wrote:

it is a shame that authors don't routinely make programming code available on publication


I absolutely agree. I have asked here before for example analysis of clinical trials and prospective or retrospective studies. Unfortunately, not much was available. I would appreciate it if you have any that I can learn from.

 

Thanks for the answer.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1217 views
  • 0 likes
  • 2 in conversation