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

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

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

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

View solution in original post

6 REPLIES 6
SteveDenham
Jade | Level 19

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

Arthur2
Calcite | Level 5
Thank you very much. Could you please also guide about how to get the standard deviation of the residuals from the model.
Thanks
SteveDenham
Jade | Level 19

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

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
SteveDenham
Jade | Level 19

@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

Arthur2
Calcite | Level 5
I got it, thanks.

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