BookmarkSubscribeRSS Feed
FestusAdejoro
Obsidian | Level 7

I had successfully run the syntax using the GLM procedure but was told to use PROC MIXED procedure. I modified to include a random statement. I keep getting an error message that there is an error. I seem to have reached a witts end as I dont even know where the error is anymore. The syntax is here reproduced.

Can anyone help modify this syntax to successfully run? My random effect relates to the Block which is a repeated measure. My main effect is the treatment (fixed) 

Please help !!!

 

title "Unpurified mimosa";

data mimosa;

input Treatment Block Gas CH4 IVOMD CH4_Gas CH4_IVOMD Gas_IVOMD;

datalines;

1     1     149.631     7.313 61.719      0.049 0.118 2.424

1     2     157.304     8.839 61.393      0.056 0.144 2.562

1     3     154.305     7.564 61.662      0.049 0.123 2.502

1     4     159.489     7.874 55.515      0.049 0.142 2.873

2     1     149.568     7.255 60.268      0.049 0.120 2.482

2     2     150.188     8.333 60.881      0.055 0.137 2.467

2     3     146.214     7.098 60.747      0.049 0.117 2.407

2     4     153.155     6.939 55.099      0.045 0.126 2.780

3     1     146.375     6.786 61.004      0.046 0.111 2.399

3     2     145.799     8.003 61.088      0.055 0.131 2.387

3     3     141.440     6.701 60.238      0.047 0.111 2.348

3     4     146.339     6.706 54.831      0.046 0.122 2.669

4     1     143.506     6.528 60.293      0.045 0.108 2.380

4     2     143.013     7.730 60.159      0.054 0.128 2.377

4     3     138.065     6.477 60.506      0.047 0.107 2.282

4     4     145.299     6.500 54.625      0.045 0.119 2.660

5     1     137.661     5.780 59.956      0.042 0.096 2.296

5     2     142.456     7.296 59.500      0.051 0.123 2.394

5     3     135.619     5.791 59.509      0.043 0.097 2.279

5     4     137.196     6.011 54.019      0.044 0.111 2.540

;

Proc print;

Proc mixed data=mimosa method=REML;

Class Treatment;

Model Gas CH4 IVOMD CH4_Gas CH4_IVOMD Gas_IVOMD= Treatment/ s;

random intercept Block /SUB=ID TYPE=UN G V;

Lsmeans Trt/pdiff;

Run;

 

2 REPLIES 2
StatsMan
SAS Super FREQ

Unlike PROC GLM, PROC MIXED does not allow for multiple dependent variables. You can only have one variable before the equals sign on the MODEL statement. Also, you have the variable ID as your SUBJECT= effect. You do not have a variable ID in your input data set, however. 

 

You can work around the limitation of the multiple dependent variables by transposing this data and creating a new class variable that contains the name of the dependent and storing the value of the dependent in a response variable called Y. I am assuming here, but your ID variable might come from the observation number in your existing data set? The value for ID might be 1 for the first obs, 2 for the second obs, and so on. That would translate to ID having the value 1 for the first 6 obs in the transposed data, the value 2 for obs 7-12, and so on.

 

Is that what you have in mind? If so, let us know if you need hep with the transposing.

SteveDenham
Jade | Level 19

Without seeing the log, it is hard to identify the error.  However, at least one thing jumps out.  PROC MIXED does not allow multiple dependent variables.  I would suggest translating your "wide" dataset to a "long" dataset like this:

 

data long_want;
length varname $9.;
set mimosa;
value=Gas; varname='Gas'; output;
value=CH4; varname='CH4'; output;
value=IVOMD; varname='IVOMD '; output;
value=CH4_Gas; varname='CH4_Gas'; output;
value=CH4_IVOMD; varname='CH4_IVOMD'; output;
value=Gas_IVOMD; varname='Gas_IVOMD'; output;
keep Treatment Block varname value;
run;

Then you can process by varname in the following PROC MIXED code:

 

proc sort data=long_want out=newmimosa;
by varname treatment block;
run;

proc mixed data=newmimosa;
by varname;
class treatment block;
model value=treatment block/solution;
repeated block/subject=treatment type= < start with UN, but CSH seems like it will be a good choice >;
lsmeans treatment/diff;
run;

SteveDenham

 

 

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
  • 2 replies
  • 397 views
  • 0 likes
  • 3 in conversation