Alberto Alvarez
Alberto Alvarez

Reputation: 855

How to Save R-squared in sas?

I have the following sas code (last few lines). What I need is to save r-squared, adjusted r-squared (besides keeping CUSIP6 trandate CRSPtrandate tshares shrvol dolvol BSI intercept mktrf smb hml umd).

proc sort data=dailyFFrets;
    by CUSIP6 trandate CRSPtrandate tshares dolvol BSI shrvol;
run;

options nonotes;

proc reg data=dailyFFrets outest=alpha (keep=CUSIP6 trandate CRSPtrandate 
        tshares shrvol dolvol BSI intercept mktrf smb hml umd) noprint;
    by CUSIP6 trandate CRSPtrandate tshares dolvol BSI shrvol;
    model rirf=mktrf smb hml umd;
quit;

options notes;

data alpha;
    set alpha;
    alpha=intercept*sign(tshares)*100;
run;

Upvotes: 1

Views: 1313

Answers (1)

A.S
A.S

Reputation: 123

This might help: http://support.sas.com/kb/22/640.html

Use an ODS OUTPUT statement to save the table named FitStatistics to a data set. See this note for more on saving tables from procedures. For example,

   ods output FitStatistics = fitstats;
   proc reg data=in;
      model y = x;
      run;

You can also specify the RSQUARE and EDF options in the PROC REG or MODEL statement to add R2 and the error degrees of freedom, respectively, to the OUTEST= data set. Requesting any additional statistic results in R2 being added to the OUTEST= data set.

For example, if you specify the ADJRSQ option, then adjusted R2 (ADJRSQ) and R2 (RSQ) are added to the OUTEST= data set.

Upvotes: 1

Related Questions