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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 9911 views
  • 0 likes
  • 4 in conversation