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

Hello .

 

In order to perform a Cox model, I am supposed to test the proportional hazard hypothesis.

 

On this site  https://stats.idre.ucla.edu/other/examples/asa2/testing-the-proportional-hazard-assumption-in-cox-mo...

I find this suggestion of code :

proc phreg data=uis;
  model time*censor(0) = age race treat site aget racet treatt sitet;
  aget = age*log(time);
  racet = race*log(time);
  treatt = treat*log(time);
  sitet = site*log(time);
  proportionality_test: test aget, racet, treat, sitet;
run; 

 

However, if I apply the code with my current variables (where “race” is categorical) I get the error :

Variable race should be either numeric or specified in the CLASS statement

If I add a line for « class age race treat site ; » I get :

Unable to convert a character value to a numeric value

Finally the only way to have this program woking is to convert my variable into numeric (white = 1 black = 2 for instance). But is it that I am supposed to do ? I have some doubts here.

 

I have a second question: When I perform the test, I get a (unique) p-value. If I understand correctly it is when the test is concluant (p-value low) that the hypothesis of proportional hazard is not verified right?

 

 

Thank you very much to who will be able to help me.

 Best regards.

1 ACCEPTED SOLUTION

Accepted Solutions
OsoGris
SAS Employee

I think the reason you need to have race as numeric is you are using it in an interaction.  Also, your treatment of the null hypothesis of the PH assumption via the test statement is correct.  

View solution in original post

2 REPLIES 2
OsoGris
SAS Employee

I think the reason you need to have race as numeric is you are using it in an interaction.  Also, your treatment of the null hypothesis of the PH assumption via the test statement is correct.  

Azertix
Calcite | Level 5

So racet = race*log(time) ; is an interaction not a multiplication even if race is numeric, I am reassured, the test make sens now.

It was counterintuitive for me because in other proc we can create interaction between categorical and numeric variable.

 

Thanks for your answers.  

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 2 replies
  • 599 views
  • 1 like
  • 2 in conversation