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

Hello,

 

I want to have in the output for a Cox regression (the table with the results for the estimates for maximum likelihood analysis) the list showing the results for each level of the independent variable "independent_v1" or "independent_v2".

 

My dataset is like this:

 

 

data have;

input 

 

id time1 event1 weight independent_v1 independent_v2;

datalines;

1 0 0 0.8 0 1

1 1 0 0.8 0 1

1 2 0 0.8 0 0

1 3 0 0.8 0 0

1 4 0 0.8 0 1

15 0 0.8 0 1

1 6 0 0.8 0 1

1 7 0 0.8 0 1

1 8 0 0.8 0 2

1 9 0 0.8 0 2

1 10 0 0.8 0 2

1 11 0 0.8 0 2

1 12 0 0.8 0 2

1 13 0 0.8 0 2

2 0 0 1.1 1 0

2 1 1 1.1 1 0

2 2 . 1.1 1 0

3 0 0 1.01 2 1

3 1 0 1.01 2 1

3 2 1 1.01 2 1

3 3 . 1.01 2 1

4 0 1 0.98 2 1

4 1 . 0.98 2 1

4 2 . 0.98 2 1

4 3 . 0.98 2 1

4 4 . 0.98 2 1

5 0 0 1.13 3 0

6 0 0 1.05 3 0

6 1 0 1.05 3 1

6 2 0 1.05 3 1

6 3 0 1.05 3 1

6 4 0 1.05 3 1

6 5 1 1.05 3 1

6 6 . 1.05 3 1

6 7 . 1.05 1 1

6 8 . 1.05 1 1

7 0 0 0.89 0 3

7 1 0 0.89 0 3

7 2 0 0.89 0 3

7 3 0 0.89 0 3

7 4 0 0.89 0 3

7 5 0 0.89 0 3

7 6 0 0.89 0 3

7 7 0 0.89 0 3

7 8 1 0.89 0 1

7 9 . 0.89 0 1

7 10 . 0.89 0 1

8 0 0 1.1 1 0

8 1 0 1.1 1 1

8 2 0 1.1 1 1

8 3 . 1.1 1 2

8 4 . 1.1 1 2

run;

 

 

When I code I have the regression results list, but I would like to know how to change the reference category for each independent variable.

 

My coding:

 

proc phreg data=have;

class independent_v1 independent_v2;

id id;

model time1*event1(0) = independent_v1 independent_v2;

weight weight;

run;

 

So SAS automatically chooses to omit one level as the reference category for each independent variable. For example, How I could change that so I choose the reference category 1 for "independent_v1" and 3 for "independent_v2", ?

 

Thanks for the help!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You can add a REF= option to each class variable and specify either the level or Ref=First (for the lowest value)

 

so

class independent_v1 (ref='category 1') independent_v2 (ref='category 3');

 

You don't mention which value might be category 1 or 3. the value would the formatted value for the variable concerned and value of interest.

View solution in original post

2 REPLIES 2
ballardw
Super User

You can add a REF= option to each class variable and specify either the level or Ref=First (for the lowest value)

 

so

class independent_v1 (ref='category 1') independent_v2 (ref='category 3');

 

You don't mention which value might be category 1 or 3. the value would the formatted value for the variable concerned and value of interest.

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