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

Hello, 

I need to obtain the residuals and then use them as the outcome in a separate model. In the past, I was able to extract the residuals using proc reg, as shown below: 

proc reg data=abstract.pedometer_speedquint2;
model stepsperday=stepmin_avg_valid ;
OUTPUT out=b r=res;
run;

proc print data=abstract.pedometer_speedquint2;
var r; /*residuals per participant*/
run;

 

However, I have not been able to figure out how to do the same using proc mixed.

 

This is the code I am using for the analysis from which I want to extract the residuals: 

 


proc mixed data=trial4;
class idno time; 
model CASI= time WMFA WMH ICV TOTAL_GM_VOL TOTAL_WM_VOL AGE RACE GENDER/s chisq;
repeated time/type=un subject=idno r rcorr;
run;

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

To add residuals to an output statement use one or both of the OutPM=<some data set name> or Outp=<some other dataset name> along with the RESIDUAL option to the MODEL statment. OutPM gives the marginal residuals and OutP gives the conditional residuals.

 

proc mixed data=trial4;
class idno time; 
model CASI= time WMFA WMH ICV TOTAL_GM_VOL TOTAL_WM_VOL AGE RACE GENDER/s chisq  OUTPM=WORK.PM RESIDUAL;
repeated time/type=un subject=idno r rcorr;
run;

Read the DETAILS section of the Online help for Proc MIXED under "Residuals and Influence Statistics" for details.

View solution in original post

1 REPLY 1
ballardw
Super User

To add residuals to an output statement use one or both of the OutPM=<some data set name> or Outp=<some other dataset name> along with the RESIDUAL option to the MODEL statment. OutPM gives the marginal residuals and OutP gives the conditional residuals.

 

proc mixed data=trial4;
class idno time; 
model CASI= time WMFA WMH ICV TOTAL_GM_VOL TOTAL_WM_VOL AGE RACE GENDER/s chisq  OUTPM=WORK.PM RESIDUAL;
repeated time/type=un subject=idno r rcorr;
run;

Read the DETAILS section of the Online help for Proc MIXED under "Residuals and Influence Statistics" for details.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 1 reply
  • 981 views
  • 3 likes
  • 2 in conversation