BookmarkSubscribeRSS Feed
JCW91
Calcite | Level 5

After running GLM, the statistics that showns are Deviance, AIC, AICC, BIC etc.... without R-square generated. How do i get the R- square everytime I have run the GLM? 

 

* I notice that there is a formula for the R-squared but I try to avoid it computing manually. 

 

Thanks in advance.

 

4 REPLIES 4
Reeza
Super User
What does your code look like that doesn't generate an R Squared? Does it include categorical variables?
Rick_SAS
SAS Super FREQ

The R-Square value is in the FitStatistics table, which is created automatically. Here are two examples where I've use ODS SELECT to display ONLY the table that has the R-square value

 

proc glm data=sashelp.class plots=none;
model height = weight;
ods select FitStatistics;
quit;

proc glm data=sashelp.class plots=none;
class sex;
model height = sex;
ods select FitStatistics;
quit;
mh2t
Obsidian | Level 7

@Rick_SAS how can we get an output in GLM for multiple variables like below:

VarName RSQUARE height_MEAN
    weight         xx                xxx
      sex            yy                yyy

Thank you for your response!

Rick_SAS
SAS Super FREQ

You can get the RSquare values for the models by putting

ods output FitStatistics(PERSIST)=Results;  /* concatenate into data set named 'Results' */

prior to the first PROC GLM call.

The mean response does not change from model to model, so that will be a constant column. 

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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