BookmarkSubscribeRSS Feed
Obsidian | Level 7

Good day dear professionals!


When using PROC GLM, one can compute the statistic of more than one dependent variable within the same PROC GLM syntax.

Take for example, the following pseudo code:


PROC GLM DATA = input_dataset;

CLASS class_var1;

MODEL dependent_var1 dependent_var2 dependen_var3 = class_var1;

LSMEANS class_var1 / ADJUST = adj_method CL;



However, for PROC GLIMMIX, one can only model just one response variable within one GLIMMIX syntax. And in my case, I have up to 14 response variables.


Would anyone be kind enough to share with me a macro (or something similar) with which I can instruct PROC GLIMMIX to repeat the modelling step for the other variables I have in my data set? I will be sincerely grateful.


Thank you very much!




Diamond | Level 26

Not a direct answer to your question, but the way you have written this example, there is no need for PROC GLIMMIX; you can use PROC GLM which does allow multiple Y variables in the MODEL statement.


Now perhaps the real problem is more complicated than this example, and you really do need PROC GLIMMIX, in which case you will need a simple macro.

Paige Miller
Obsidian | Level 7

I'm dealing with count data. GLM can't correctly model count data. That's why I need GLIMMIX to accommodate for overdispersion.


I know I need a macro but I can't write one because i don't have the know-how to do so. That's why I asked.


The article "An easy way to run thousands of regressions in SAS"

provides a macro solution and also a By-group solution. For the By-group solution, you transform the data from wide to long, then use a BY statement to run the 14 regression models. The article shows how to perform regressions of the form

Y = X1

Y= X2

Y = X3


but it should be clear how to modify the technique to model 

Y1 = X

Y2 = X

Y3  = X



Obsidian | Level 7

Thank you very much Rick!


This looks very much like the help I need.


I'm grateful!

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
  • 4 replies
  • 3 in conversation