BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am now running regression using proc reg function. My data set is a panel dataset. It contains 16 years data and for each year, it has thousands of observations. What I want to do is to run regression by each year first and after I get all the regression results out (16 groups of coefficients), I need to get the average of all the coefficients and R-squares. Now by the following statement, I am able to get the average of all the coefficients, but I am not able to get the average of R-squares. Is it possible to get averaged R-squares? Could anyone help me with it? Thanks very much.

ods listing close;
ods output parameterestimates=pe;
proc reg data=dset;
by year;
model depvar = indvars; run;
quit;
ods listing;

proc means data=pe mean std t probt;
var estimate; class variable;
run; Message was edited by: GingerLee
2 REPLIES 2
Olivier
Pyrite | Level 9
Hi.
You should create a second dataset containing R-squares.
[pre]
ods output parameterestimates=pe fitStatistics=fs ;
[/pre]
And then process it in the same way as you did with the coefficients.
Regards.
Olivier
deleted_user
Not applicable
Thanks very much, Olivier. I followed what you told me and got the results.

Best,

gingerLee

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 Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 977 views
  • 0 likes
  • 2 in conversation