SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
anujmehta
Calcite | Level 5

I have a fairly simple question. I am using proc glimmix to compare the odds of death (binary outcome) of across several different levels a categorical variable ( call it cat with 4 levels 1, 2, 3, 4), adjusting for several clinical variables (var1-var4) and clustering by hospital. In the class statement, i can specify the reference level for cat (e.g., level 1) which will lead to estimates for 2 v 1, 3 v 1, and 4 v 1 which can be converted to odds ratios (the primary outcome we want to publish).

 

proc glimmix data=model;

class hospital cat (ref=first);

model death (event='1') = cat var1 var2 var3 var4 / dist=binary link=logit solution;
random intercept /subject=hospital; run; 

 

However, we are interested in a variety of comparisons (e.g. 3 v 2, 3 v 4, 1 v 3, etc.). Again, we ideally want exponentiated values (odds ratios) and we do not want to have to run the model multiple times with different reference levels. I think the estimate statement could get me where i want to go but I am having trouble coding it properly as I am not so sure of the order of the categories when i define a reference level or when i dont define a reference level. 

 

would the following estimate statements generate the correct comparisons:

estimate '3 v 2' cat 0 -1 1 0/exp cl;

estimate '3 v 4' cat 0 0 1 -1/exp cl;

estimate '1 v 3' cat 1 0 -1 0/exp cl;

 

Also, when using estimate statements does defining a reference level in the class statement (i.e., class hospital cat (ref=first)) impact the estimate statements?

 

Thanks for thinking about what i hope is a simple question.

 

2 REPLIES 2
Ksharp
Super User
Your code looks good.
And I don't think the class statement would impact estimate statement.
class statement is used to form DESIGN matrix ,and could impact the LSMEAN,SLICE statement.
PaigeMiller
Diamond | Level 26

Don't use contrast or estimate in this case. You will get the proper comparisons from the LSMEANS statement.

 

SAS has done the hard work of properly coding the contrast or estimate behind the scenes of the LSMEANS statement, so you don't have to struggle with it.

--
Paige Miller

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 660 views
  • 0 likes
  • 3 in conversation