BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Colmstead
Calcite | Level 5

I am working on a Multivariate multilevel model where The 3 outcome variables RCBPre_Rating RCTPre_Rating RCSPre_Rating are continuous but changes in all three need to be considered simultanously as participants can indicate more or less of each RC type and this combination explains what they believe the complex root causes of an Ableism scenario are (RC1 is bias, RC2 is a lack of training, and RC3 is systemic barriers). The data set is double stacked where items (vignettes) are nested within Participants. There are item-level variables of ableism type (AT, 4 categories) (OB, 4 levels), and 2 item-level covariates of Trial oder. There are participant-level variables of teacher type (TT, 3 categories), and years of experience (YOE), and the participant-level covariates such as other demographic variables ( INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess). I have tried two different ways to get the model to run, one using mutilple model lines in the proc mixed statement, and one using one model line with all three outcome variables, neither way is working! please help me! Syntax for each way is shown below.

First way:

proc mixed data=RQ2 method=ml;
class ResponseID Vignette AT OB Teachertype INLevel INdisschool INLOE PerDis FamDis EthnicitySel Race Gender ADCTO Vtrialorder; 

/* Model statement for RC1 */
model RCBPre_Rating = OB|AT Teachertype|YOE Teachertype|YOE INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO Vtrialorder / solution ddfm=bw;
/* Model statement for RC2 */
model RCTPre_Rating = OB|AT Teachertype|YOE Teachertype|YOE INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO Vtrialorder / solution ddfm=bw;
/* Model statement for RC3 */
model RCSPre_Rating = OB|AT Teachertype|YOE Teachertype|YOE INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO Vtrialorder / solution ddfm=bw;

/* Random effects */
random intercept / subject=ResponseID type=un; /* Random intercept for participants */
random intercept / subject=vignette type=un; /* Random intercept for vignettes */

/* Random slopes for participant-level effects */
random ADCTO / subject=vignette;

Vtrialorder / subject=vignette;
random OB / subject=vignette;
random AT / subject=vignette;

/* Allow covariance structure to account for multivariate response */
repeated / subject=ResponseID*vignette type=un group=ResponseID;

run;

Second way: 

proc mixed data=RQ2 covtest NOCLPRINT Method=REML;
class ResponseID Vignette AT OB Teachertype INLevel INdisschool INLOE PerDis FamDis EthnicitySel Race Gender ADCTO Vtrialorder;

/* Model statement for RC1 */
model RCBPre_Rating RCTPre_Rating RCSPre_Rating = OB|AT Teachertype|YOE Teachertype|YOE INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO Vtrialorder / solution DDFM=Satterthwaite;

/* Random effects */
random intercept / subject=ResponseID type=un; /* Random intercept for participants */
random intercept / subject=Vignette type=un; /* Random intercept for vignettes */

/* Random slopes for participant-level effects */
random ADCTO / subject=ResponseID;
random Vtrialorder / subject=ResponseID;
random OB / subject=Vignette;
random AT / subject=Vignette;

/* Allow covariance structure to account for multivariate response */
repeated / subject=ResponseID*vignette type=un group=ResponseID;
parms / ols;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

I think this may be as simple as defining an additional indicator variable (say type as one of the following RCTPre_Rating, RCBPre_Rating, RCSPre_Rating, and putting the value of each into a single response variable in a long format dataset). You could then fit:

 

model  response= type OB|AT Teachertype|YOE  INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO Vtrialorder / solution ddfm=bw;

If you have sufficient data, you could even include some interactions of type with the other covariates.

 

SteveDenham

 

View solution in original post

5 REPLIES 5
ballardw
Super User

"Not working" is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the "</>" to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "</>" icon or attached as text to show exactly what you have and that we can test code against.

Colmstead
Calcite | Level 5

For the proc mixed with multiple model statements I get the log warning: 

WARNING: Only the last MODEL statement is used.
WARNING: The R matrix depends on observation order within subjects. Omitting observations from
the analysis because of missing values can affect this matrix. Consider using a
classification effect in the REPEATED statement to determine ordering in the R matrix.
NOTE: 228 observations are not included because of missing values.
WARNING: Stopped because of infinite likelihood.
NOTE: PROCEDURE MIXED used (Total process time):
real time 18.02 seconds
cpu time 19.21 seconds

 

 

For the Proc mixed with one model statement with all three outcome variables I get: 

proc mixed data=RQ2 covtest NOCLPRINT Method=REML;
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

NOTE: The SAS System stopped processing this step because of errors.
93 class ResponseID Vignette AT OB Teachertype INLevel INdisschool INLOE PerDis FamDis
93 ! EthnicitySel Race Gender ADCTO Vtrialorder;
94
95 /* Model statement for RC1 */
96 model RCBPre_Rating RCTPre_Rating RCSPre_Rating = OB|AT Teachertype|YOE Teachertype|YOE
-------------
73
202
96 ! INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO
96 ! Vtrialorder / solution DDFM=Satterthwaite;
ERROR 73-322: Expecting an =.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
97
98 /* Random effects */
99 random intercept / subject=ResponseID type=un; /* Random intercept for participants */
100 random intercept / subject=Vignette type=un; /* Random intercept for vignettes */
101
102 /* Random slopes for participant-level effects */
103 random ADCTO / subject=ResponseID;
104 random Vtrialorder / subject=ResponseID;
105 random OB / subject=Vignette;
106 random AT / subject=Vignette;
107
108 /* Allow covariance structure to account for multivariate response */
109 repeated / subject=ResponseID*vignette type=un group=ResponseID;
110 parms / ols;
111 run;

 

 

Colmstead
Calcite | Level 5

I have attached My DATA set and syntax files here as well. 

SteveDenham
Jade | Level 19

I think this may be as simple as defining an additional indicator variable (say type as one of the following RCTPre_Rating, RCBPre_Rating, RCSPre_Rating, and putting the value of each into a single response variable in a long format dataset). You could then fit:

 

model  response= type OB|AT Teachertype|YOE  INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO Vtrialorder / solution ddfm=bw;

If you have sufficient data, you could even include some interactions of type with the other covariates.

 

SteveDenham

 

jiltao
SAS Super FREQ

Like @SteveDenham mentioned, you can create a new variable indicating which type the response is, turn the data into a long format and fit a model accordingly. Please note that there is only one MODEL statement allowed in PROC MIXED, and only one response variable in the MODEL statement to be specified.

Here is an example to show you this approach:

subject  height weight gender

1              165         56          F

2             180         76          M

....

data two;

 set one;

 response=height;

 type='Height';

output;

response=weight;

type='Weight';

output;

drop height weight;

run;

Then use Response as your dependent variable in the MODEL statement, and include TYPE as one of your effect in the MODEL statement.

In your case, the values for TYPE would be your original response variables.

Hope this helps,

Jill

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 5 replies
  • 1378 views
  • 2 likes
  • 4 in conversation