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) 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.
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.
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.
It may affects the order the results are presented/displayed in, but not the values.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.