BookmarkSubscribeRSS Feed
sasnewbie12
Obsidian | Level 7

I am comparing the effects of four treatments, x1,x2,x3,x4 on an outcome, y. I am using proc GLM to run this analysis. I need to calculate the standardized residuals for the model, how can I do that?

 

Thank You

3 REPLIES 3
Reeza
Super User

What's your definition of standardized residual?
SAS calculates a studentized residual as residual/ stderr, which appears the same by some definitions:

http://www.r-tutor.com/elementary-statistics/simple-linear-regression/standardized-residual

 

http://documentation.sas.com/?docsetId=statug&docsetTarget=statug_glm_syntax17.htm&docsetVersion=14....

 

You can get that using the OUTPUT statement, STUDENT option. 

 


@sasnewbie12 wrote:

I am comparing the effects of four treatments, x1,x2,x3,x4 on an outcome, y. I am using proc GLM to run this analysis. I need to calculate the standardized residuals for the model, how can I do that?

 

Thank You


 

 

 

 

travis945
Calcite | Level 5

Hello,

 

I used the OUTPUT statement and STUDENT option, but I'm not sure how to print the standardized residuals. Here is my code:

 

proc reg data=work.'chp 14 # 50'n;

model y=x

output residual=yresid

predicted=yhat

student=stdres;

run;

 

Thank you!

-Travis

PaigeMiller
Diamond | Level 26

You could use the R option in the MODEL statement. Or:

 

you should probably give the output data set a name

 

output OUT=RESIDUALS residual=yresid predicted=yhat student=stdres;

Then you could use PROC PRINT or VIEWTABLE or many other procedures to see the residuals.

 

A side question ... why would you want to PRINT residuals or standardized residuals? I see no benefit there ... rather your ought to be PLOTTING residuals, and there are many ways to do that.

--
Paige Miller

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