DATA Step, Macro, Functions and more

Calculate Stock Return-BHAR

Occasional Contributor
Posts: 15

Calculate Stock Return-BHAR


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

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
Valued Guide
Posts: 2,190

Re: Calculate Stock Return-BHAR

In what structure are your data?
Occasional Contributor
Posts: 15

Re: Calculate Stock Return-BHAR

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)

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

Super User
Posts: 10,389

Re: Calculate Stock Return-BHAR

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

Posts: 1

Re: Calculate Stock Return-BHAR

Yes, ∏ is to mean cumulative multiply

I think the equation might be as followed,




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!

Ask a Question
Discussion stats
  • 4 replies
  • 4 in conversation