Hi, I'm using proc mix to fit ANCOVA model to get the following:
1) LS means of each treatment
2) SE of each treatment
3) LS means difference (placebo - each treatment) with placebo as treatn=3
4) SE difference (placebo - each treatment)
5) SD (standard deviation of residuals from the model)
6) Plot studentized residuals versus predicted values, and also check the distribution of (unstandardized) residuals using a plot.
The code is:
ods output lsmeans=estimate
diffs=diff;
proc mixed data = mydata (where=(treatn in (1,2,3)));
by treatn treat avisitn avisit;
class treatn;
model aval = treatn avisitn base;
lsmeans treatn / diff=control('3');
run;
ods output close;
I'm getting error:
"WARNING: Output 'Diff' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify
that the appropriate procedure options are used to produce the requested output object. For example, verify that the
NOPRINT option is not used."
Help is needed to resolve the error and guidance to use the proc mix appropriately to achieve above mentioned requirements for ANCOVA.
Thanks
Your BY statement has treatn in it. Consequently, MIXED is trying to fit separate models for each level of treatn. As a result, there are no differences between treatn lsmeans - just a single lsmean value. Thus, the error for diffs=diff. The solution is to remove treatn from the BY statement.
SteveDenham
Your BY statement has treatn in it. Consequently, MIXED is trying to fit separate models for each level of treatn. As a result, there are no differences between treatn lsmeans - just a single lsmean value. Thus, the error for diffs=diff. The solution is to remove treatn from the BY statement.
SteveDenham
This will be a two-step process.
First generate the dataset containing the residuals by adding two options to the MODEL statement (outp= and residual)
ods output lsmeans=estimate
diffs=diff;
proc mixed data = mydata (where=(treatn in (1,2,3)));
by treat avisit;
class treatn;
model aval = treatn avisitn base/outp=predicts residual;
lsmeans treatn / diff=control('3');
run;
ods output close;
Then, use PROC MEANS (or SUMMARY or UNIVARIATE or SQL) to calculate the SD for the residual variable. Off the top of my head, I don't recall the variable name for the residuals, but it probably defaults to something like 'resid'.
proc means data=predicts noprint;
var resid;
output out=resid_sd std(resid)=std_resid;
run;
If you are looking for standard deviations by treatn, you can add a CLASS statement.
SteveDenham
I'm thinking that since this isn't really a Mixed model, as there are no random terms, that PROC GLM ought to work, and it will provide the mean square for error (variance of the residuals) directly.
@PaigeMiller , the sound you just heard was me slapping my own face. This is an EXCELLENT observation. The RMSE from PROC GLM is the standard deviation of the residuals.
SteveDenham
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.