BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
abdulla
Pyrite | Level 9

Hi,

I have panel data (company identification=GVKEY and Year=Fyear).

I want to measure  the coefficient of the market return when daily returns are regressed on market
returns. I use the following code but don't know how to get beta coefficients. I have to use the beta coefficients as dependent variable for the other regressions

 

Proc reg data=have noprint;
model ret=sprtrn;
output out=want;

 

 

Can anyone please help me?

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
Proc reg data=have noprint outest=want ;

If it is panel data, better check PROC PANEL .

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

The beta coefficients are automatically output by PROC REG to the results, they are called "Parameter Estimates", as shown in this example: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=statug&docsetTarget=statu...

--
Paige Miller
Ksharp
Super User
Proc reg data=have noprint outest=want ;

If it is panel data, better check PROC PANEL .
abdulla
Pyrite | Level 9

Ksharp,
In my data, I have millions of data. These are daily return data as I stated in my original post. I use the following code


proc reg data = have outest=want noprint;
by gvkey fyear;
model ret = mktrtrn;
run;


My confusion is that since I have date (daily), should I use fyear or date in by statement? I tried both and see that there is (zero) coefficient of beta when I use date but if I use fyear, I get different beta coefficient (expected results) in the output. When I use by gvkey fyear statement, the out put is yearly. I think the yearly coefficients come from daily return regression. If this is correct, this is what I want. I want to make sure that I am doing things correctly by using fyear not date in by statement as shown above in the syntax.

Is there any difference in the out put if I use proc reg instead of proc panel. I am using the following code for proc panel

proc panel data=have noprint outest=want1;
model ret = mktrtrn / rantwo;
id gvkey date;

run;

 

---- here I am using date because SAS is giving me error message if I use fyear. It says first obs is 2002 and 2nd is also 2002.So, they are not sorted properly though I sorted them by gvkey fyear. If I do by gvkey and date SAS says that not enough memory


Could you please tell me whether I am doing things correctly by using proc reg? If I want to use proc panel what would be the correct code?

 


gvkey date fyear ret mktrtrn
1004 20020102 2002 0.05 0.0089051
1004 20020103 2002 0.176 0.003451
1004 20020104 2002 0.001 0.0235
. . . . .
. . . . .
. . . . .
1004 20021227 2002 0.0235 0.0035651
1004 20021230 2002 0.11276 0.1805
5250 20030102 2003 0.003451 0.00567451
5250 20030103 2003 0.0012451 0.176
5250 20030104 2003 0.0089051 0.001
. . . . .
. . . . .
. . . . .
5250 20031227 2003 0.0035651 0.11276
5250 20031230 2003 0.00567451 0.0012451

Ksharp
Super User
"My confusion is that since I have date (daily), should I use fyear or date in by statement?"
It is depended on what you need. Do you need a rolling windows for PROC REG ? one month or one year ?
If not , I think your code is right .

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 2718 views
  • 3 likes
  • 3 in conversation