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

Hello

I am trying to test multiplicative interaction between 2 categorical variables with more than 2 categories. 

 

Would it be appropriate to use this code?

 

proc phreg data=new;

class diet_scorecategory (ref="1");

model (time*outcome(0) = bmicategory diet_scorecategory interactionterm;

interactionterm=bmicategory*diet_scorecategory;

run;

 

I would appreciate the help!

 

Thank you 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @anonymous_user,

 

As a categorical variable bmicategory should be inserted into the CLASS statement. In many cases categorical variables are character variables, so a multiplication as in your assignment statement would be invalid anyway. Even if both categorical variables are numeric, interactionterm will not be recognized as an interaction term (despite its name and definition) -- with several degrees of freedom (depending on the numbers of categories and the parameterization method) --, but treated as a continuous variable (with only one degree of freedom), which is likely not what you want. Therefore, omit the assignment statement and replace interactionterm with bmicategory*diet_scorecategory in the MODEL statement.

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hello @anonymous_user,

 

As a categorical variable bmicategory should be inserted into the CLASS statement. In many cases categorical variables are character variables, so a multiplication as in your assignment statement would be invalid anyway. Even if both categorical variables are numeric, interactionterm will not be recognized as an interaction term (despite its name and definition) -- with several degrees of freedom (depending on the numbers of categories and the parameterization method) --, but treated as a continuous variable (with only one degree of freedom), which is likely not what you want. Therefore, omit the assignment statement and replace interactionterm with bmicategory*diet_scorecategory in the MODEL statement.

Hello @FreelanceReinh many thanks! It worked 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 626 views
  • 3 likes
  • 2 in conversation