BookmarkSubscribeRSS Feed
Ji-Hoon
Calcite | Level 5

Hello,

 

So, I have a dataset that has around 200-250 daily stock returns data for one firm (permno) - one year (fiscal year) pair.

I'm trying to get the standard error of the predicted value (stdp) & the standard error of the residuals (stdr) from the regression for each firm-year pair.

 

After sorting my dataset, I'm trying to use the following code:

 

proc reg data=risk3_1;

    by permno fyear;

    model  exret=mktrf;

    output out=est stdp=stdp stdr=stdr;

quit;

 

This clearly does not give me the desired output. Also, it just churns out 'stdp' and 'stdr' for each day (It's too many!!). 

Thank you for your help in advance.

1 REPLY 1
Rick_SAS
SAS Super FREQ

The statistics in your output data set are observation-wise statistics, which means you get one for each boservation.

Perhaps you prefer to output model statistics, such as the SEB (standard errors of the parameter estimates) and the PRESS statistic? If so, look at the doc for the PROC REG statement and use the OUTEST= option, as follows:

 

data stocks;
set sashelp.stocks(rename =(Stock=permno));
fyear = year(Date);
run;

proc sort data=stocks;
by permno fyear;
run;

proc reg data=stocks noprint outest=Est OUTSEB PRESS;
by permno fyear;
model Close = Open;
quit;
 
proc print data=Est(obs=10); run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 917 views
  • 0 likes
  • 2 in conversation