BookmarkSubscribeRSS Feed
always-good
Obsidian | Level 7

Hello, back SAS community,

Why can we not run more than one response variable in the model line when performing a model using a mixed procedure?

For example, if we want to try something other to gain according to school ....it will be an error. How to do this, please?

proc mixed data=test_scores;
class school ethnicity gender teacher;
model gain = school ethnicity gender / solution;
random int / subject=teacher;
run;

 

8 REPLIES 8
Ksharp
Super User
I don't understand what you mean .
You mean have two or three Y variable in mixed model, like this ?
model gain height weight = school ethnicity gender / solution;

Any GLM or Mixed model is not able to have more than one Y variable. If you really need multiple Y variables, you could try PROC PLS , but that is not builded a Mixed Model.
always-good
Obsidian | Level 7

thank you for your reply,  so in this case. we try one by one ...

PaigeMiller
Diamond | Level 26

You could repeat the code, but modifying the response variable.

--
Paige Miller
always-good
Obsidian | Level 7

Thank you for your answer. So why in GLM we can test multiple response variables and multiple factors but in the mixed only one response variable and multiple factors? The mixed model is not more sophisticated.

PaigeMiller
Diamond | Level 26

Why? Does it matter? You can't do it in MIXED, so the solution is to run MIXED several times.

 

If you really need to know why, perhaps @Rick_SAS or @StatDave has an explanation.

 

"The mixed model is not more sophisticated" -- again, does it matter, MIXED does what it does.

 

And actually it is with respect to estimating the effect of the X-variables, a lot more sophisticated models can be fit with MIXED than you can fit with GLM.

--
Paige Miller
always-good
Obsidian | Level 7

Thanks a lot for your answer. It is only to know this information which you are giving...

Ksharp
Super User
"So why in GLM we can test multiple response variables "
That is the same as repeated multiple times PROC GLM.
For example:
proc glm;
model height weight= a b;
quit;
is the same as
proc glm;
model height=a b;
quit;
proc glm;
model weight=a b;
quit;

Therefore, if you want do the same thing for PROC MIXED, as Paige said repeat proc mixed several times.
For example:
proc mixed;
model height=a b;
random int/subject=subj;
run;
proc mixed;
model weight=a b;
random int/subject=subj;
run;
SteveDenham
Jade | Level 19

Hey everyone - there is a way to use PROC MIXED to fit multiple response variables. A good example can be found in the documentation for the TYPE= option for the REPEATED statement. Look at TYPE=UN@AR(1), where Height and Weight for children measured over time is given. The code suggested is:

 

proc mixed;
   class Var Year Child;
   model Y = Var Year Var*Year;
   repeated Var Year / type=un@ar(1)
                       subject=Child;
run;

A similar situation is included in the PROC GLIMMIX documentation, but is much more difficult to implement. Start with the example: Joint Modeling of Binary and Count Data. Note that this approach requires different distribution types for each of the dependent variables, which is not required for the PROC MIXED method.

 

SteveDenham

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 8 replies
  • 1428 views
  • 1 like
  • 4 in conversation