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

Recently i had to use Proc Phreg and being a non stats programmer, I have some doubts which I'm sharing here so I can get some help from experts:


A variable ABC has 2 categorical values 0 and 1 sorted in ascending order within the treatment (TRT).

I wanted to understand how PHREG decides the Reference among these 2 values (0 & 1) for the Hazard Ratio in following cases when used in class statement: I understand that by default it considers LAST level. So REF= is used to explicitly tell the SAS the reference value and not decide by its own(correct me if i'm wrong).

So here what I want to understand is:

A) Does prior sorting of class variable matters even if REF= is used (as in ex. 1)

B) Does / DESC option makes difference if used along with REF= (as in ex 2)

C) If no CLASS statement is used, does PHREG sorts abc variable internally and consider LAST ordered value as reference (ex. 3)?

Please let me know if my question is not clear.

1) Proc phreg data = test;

     BY trt;

     CLASS abc(ref=’0’) ;

     MODEL time*censor(1) = abc /ties=exact rl;

     STRATA s1 s2;

  Run;

2) Proc phreg data = test;

By TRT;

CLASS abc(ref=’0’) /DESC;

MODEL time*censor(1) = abc /ties=exact rl;

STRATA s1 s2;

RUN;

3) *Without CLASS Statement ;

Proc phreg data = test;

By TRT;

MODEL time*censor(1) = abc /ties=exact rl;

STRATA s1 s2;

RUN;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

1) No

2) Not for calculations - only for presentation

3) No, it treats the value as numeric or generates an error if the variable is character.

You may also want to look into PARAM= option on the class statement that denotes how SAS codes the reference variables. The output will print out the design matrix that lets you know.

SAS/STAT(R) 9.2 User's Guide, Second Edition

View solution in original post

3 REPLIES 3
Reeza
Super User

1) No

2) Not for calculations - only for presentation

3) No, it treats the value as numeric or generates an error if the variable is character.

You may also want to look into PARAM= option on the class statement that denotes how SAS codes the reference variables. The output will print out the design matrix that lets you know.

SAS/STAT(R) 9.2 User's Guide, Second Edition

MannMishra
Calcite | Level 5

Reeza, Thanks for reply. I could not understand your reply for the 2nd question (i.e. Not for calculations - only for presentation).

My assumption was I should get same Hazard ratio from Ex.1 (without DESC option) and Ex. 2 (with DESC option). So can i say it impacts the output?

I'll try with PARAM= option to look how the design matrix is created. Thanks for suggesting.

Reeza
Super User

It may affects the order the results are presented/displayed in, but not the values.

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!
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
  • 3 replies
  • 2832 views
  • 8 likes
  • 2 in conversation