Programming the statistical procedures from SAS

Class statement in Proc PHReg

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Class statement in Proc PHReg

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;


Accepted Solutions
Solution
‎07-09-2015 01:31 PM
Grand Advisor
Posts: 16,908

Re: Class statement in Proc PHReg

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


All Replies
Solution
‎07-09-2015 01:31 PM
Grand Advisor
Posts: 16,908

Re: Class statement in Proc PHReg

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

New Contributor
Posts: 2

Re: Class statement in Proc PHReg

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.

Grand Advisor
Posts: 16,908

Re: Class statement in Proc PHReg

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 309 views
  • 8 likes
  • 2 in conversation