BookmarkSubscribeRSS Feed
amanda_cz
Calcite | Level 5

Hi! I am running a time series model with multiple firms with multiple years of observation (more than 10,000 observations). I want to get R-squares for  individual firms. I know that r-square will show up in the individual firms' output report.But I don't know how to obtain a data file includes both firm_id and also R-square for each firm. Any suggestion will be appreciated.

The following is my SAS data and code information.

my basic code is

PROC AUTOREG DATA=TS;

by firm_id;

MODEL price=bps;

OUTPUT OUT=OUT1;

RUN;

Original data sample:

image.png

1 REPLY 1
SteveDenham
Jade | Level 19

Try using ODS to get a dataset with the R squared values:

PROC AUTOREG DATA=TS;

by firm_id;

MODEL price=bps;

OUTPUT OUT=OUT1;

ods output fitstatistics=fitstatistics;

RUN;

This will generate a dataset in your WORK library with the regression R squared values for each BY variable.

Steve Denham

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1487 views
  • 0 likes
  • 2 in conversation