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!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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