Fluorite | Level 6

## Re: Cumulative Abnormal Return Calculations

Thank you very much for all. I will run the codes and let you know.

Abu Chowdhury

Fluorite | Level 6

## Re: Cumulative Abnormal Return Calculations

Hi,

I submitted your proc sql codes but it's taking very long time. For example, it takes more than two hours to calculate the CAR for different windows (such as (0,65) days, (66,130) days etc.)  when the dataset has 2502 event days (tradedate). I have another dataset where there are approximately 35,000 event days, and it took more than 40 hours to get the CARs ! Is it normal for taking such long time or is there something wrong?

In the attached file, I calculated the CARs for different windows using your codes. For each firm (the variable 'Code' ) I need to have only one CAR for each year. For example, if the same firm has multiple CARs in a specific year because of the multiple tradedates, the average (or sum) of those CARs for that year needs to be calculated. It means, for each firm for each year there should be one CAR value. How can I do that?

Abu Chowdhury

Super User

## Re: Cumulative Abnormal Return Calculations

You can make three index for code, date , tradedate  respectively . Maybe That would fast you.

And about more fast way, what I could think is using Hash Table , But that is a long story to tell.

Xia Keshan

Fluorite | Level 6

## Re: Cumulative Abnormal Return Calculations

Thanks but I did not understand how to make index. I will be grateful if you tell me.

In the attached file, I calculated the CARs for different windows using your codes. For each firm (the variable 'Code' ) I need to have only one CAR for each year. For example, if the same firm has multiple CARs in a specific year because of the multiple tradedates, the average (or sum) of those CARs for that year needs to be calculated. It means, for each firm for each year there should be one CAR value. How can I do that?

Super User

## Re: Cumulative Abnormal Return Calculations

```data class;
set sashelp.class;
run;
proc datasets library=work;
modify class;
index create age;
quit;

```

Start a new topic, and let others knows your problem, I can't get you .

Xia Keshan

Fluorite | Level 6

## Re: Cumulative Abnormal Return Calculations

Hi,

Something is going wrong. If you remember, you gave me the following proc sql for calculating cumulative abnormal returns.

proc sql;

create table want as

select a.*,(select sum(value) from x where code=a.code and date between tradedate and tradedate+65) as _65

quit;

However, I ran this for 3 days ( ..... tradedate and tradedate+3) and manually checked the results. Surprisingly, it shows correct car in some event days but in many cases it shows wrong cars for respective event days (tradedate). What's the reason for that? I gave you the two datasets previously; please check and let me know.

Fluorite | Level 6

## Re: Cumulative Abnormal Return Calculations

I think the reason is as follows. When I wanted to calculate the CAR for (0,65) days window, I wanted to calculate actually for (0,3) months window. Since the dataset has approximately 260 observations per year (because, no data for weekends and holidays), so 3 months mean approximately 65 observations per year. But, according to calendar days, there are approximately 91 days in a 3-month period. Your sql proc chooses the calendar days. So in your proc sql when you wrote (…..between tradedate and tradedate+65), it took the 65 calendar days. So, since I want a 3-month window, I should write:

Please let me know whether I am correct or not.

Super User

## Re: Cumulative Abnormal Return Calculations

Yes. You are right. I am counting Calendar days.

About your only one CAR for every year and every company . you can do this:

After you get CAR for every obs , you can do this:

select .........,avg(_65) as one_avg

from want

group by code,year ;

Xia Keshan

Fluorite | Level 6

## Re: Cumulative Abnormal Return Calculations

Thanks a lot.

Discussion stats
• 23 replies
• 8450 views
• 6 likes
• 3 in conversation