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

Hello SAS communities! 

 

Suppose I would like to fit 

_MooMoo_0-1600219670630.png

where X1 and X2 are dichotomous variables.

 

Below code will give me HR of X1 at each level of X2 due to interaction term.

proc phreg data=demo;

   class X1 X2 / param=ref;

   model (start, stop) * Y(0)=X1 X2 X1*X2;

   hazardratio X1/diff=ref;

 

However, I am trying to output overall effect of X1. In other words, I would like to say - Y increased/decreased by __% when X1=1 comparing to X1=0 after accounting for other covariates in the model.

 

In that case, will below code output the number I need to make above statment? LSMEANS only work under param=glm... will this different from when setting param=ref?

proc phreg data=demo;

   class X1 X2 / param=glm;

   model (start, stop) * Y(0)=X1 X2 X1*X2;

   lsmeas X1/cl;

 

Thank you! If you have other suggestions, I appreciate that too!

 

1 ACCEPTED SOLUTION

Accepted Solutions
pink_poodle
Barite | Level 11
Yes, but you need to to explicitly state that your reference term is X1, like so:
class x1 x2 / param=glm ref=x1;
For more information about class and param, please see:
https://documentation.sas.com/?docsetId=statug&docsetVersion=15.1&docsetTarget=statug_phreg_syntax06...

View solution in original post

4 REPLIES 4
pink_poodle
Barite | Level 11
Yes, but you need to to explicitly state that your reference term is X1, like so:
class x1 x2 / param=glm ref=x1;
For more information about class and param, please see:
https://documentation.sas.com/?docsetId=statug&docsetVersion=15.1&docsetTarget=statug_phreg_syntax06...
_MooMoo
Obsidian | Level 7

Thank you for the suggestion! 

However, when I add ref=X1 statement after param=glm, it gives an error like below.


ERROR 22-322: Syntax error, expecting one of the following: FIRST, LAST.
ERROR 76-322: Syntax error, statement will be ignored.

 

 

pink_poodle
Barite | Level 11

This is because it has to be a level: REF=’level’, sorry, not X1. Like if your variable has levels 0 and 1, and you want to compare to 1, then it would be REF='1'.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2421 views
  • 2 likes
  • 2 in conversation