BookmarkSubscribeRSS Feed
q1234
Calcite | Level 5
Hi,

Can help me with SAS code to calculate stock return using buy-and-hold abnormal return using the follwoing formula:


T T
BHARi=∏(1+Ri,t) - ∏ (1+Rbenchmark,t)
t=1 t=1


Where R i,t is the monthly return for firm i in month t, and R benchmark, t is the monthly
return for the benchmark in month t.
Firm i is the firm which I need to calculate stock return
The benchmark in my case is the matched firm similar to firm i in the size.


Also the code should include the following restriction:
If the matched firm delisted before calculating the return for firm i, then the next best match should be substituted for the next period.

Many thanks Message was edited by: q1234
4 REPLIES 4
Peter_C
Rhodochrosite | Level 12
In what structure are your data?
q1234
Calcite | Level 5
I have around 700 firms and for each one of them I will calculate the return from a specific date, let us call it the the event year.
so I have the following structure ( the firms, the eventyear, the monthly stock pric for three years after the event year)

Ex;
Portfolio 1(the event firms)
firms event date closing stock prices Jan1999 feb1999.............Dec2001
i 01/01/999 .2 .35 .45

Portfolio 2(the matched firms)
firms date closing stock prices Jan1999 feb1999.............Dec2001
x 01/01/999 .3 .18 .63


Thanx
Ksharp
Super User
Can you explain the formula ,∏ is to mean cumulative multiply?
And What output looks like?



Ksharp
yealing
Calcite | Level 5

Yes, ∏ is to mean cumulative multiply

I think the equation might be as followed,

   ret=(exp(lret))-1;

   benchret=(exp(lbenchret))-1;

   bhar=(ret-benchret)*100;

but I don't know how to use the loop to get the buy-and-hold abnormal return on 12 , 24, and 36 months separately.

Thank for your help!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 11050 views
  • 0 likes
  • 4 in conversation