ods output ParameterEstimates = capmparam
(keep= dsName Variable Estimate);
proc autoreg data=longcapm;
by dsname;
model stockreturn = wtindexreturn / dwprob;
test wtindexreturn = 1;
output out=capmout p=p r=r ucl=u lcl=l alphacli=.10;
run;
In ods output, i wish to include the 'Total R-Square'. However i am not sure how to specify it in keep=.
I would appreciate some assistance on this!
I'm not sure exactly how you want the results. It seems as though you want data sets, so I went ahead and did this. The solution is in the ODS TRACE statement. It prints all the HTML results and their respective names to the log. Then you trace down exactly what you need. Note: I have no experience with the AUTOREG procedure, but I went ahead and created a fake data set.
data have;
input value time;
datalines;
1 1
3 2
5 3
7 8
9 7
2 9
;
run;
ods trace on; /* Trace the HTML results in the log. */
proc autoreg data = have;
model value = time;
run;
ods trace off; /* Turning off for good practice. */
/* Extract the part of the report you want. I name the output data set here 'want'. I also mimicked your call for the parameter estimates */
ods output parameterestimates = capmparam
fitsummary = want (where = (label2 = "Total R-Square"));
proc autoreg data = have;
model value = time;
run;
/* Just showing the 'want' data set via PROC PRINT */
proc print data = want;
run;
Obs Model Label1 cValue1 nValue1 Label2 cValue2 nValue2 1 Model1 Durbin-Watson 1.9201 1.920052 Total R-Square 0.2091 0.209074
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.