Dear mkeniz,
I have difficulty to understand the generated output by sas program you advised. I would like to compute the following BHAR:
Buy and Hold Abnormal return= ((1+return(m1))(1+return(m2))----(1+return(m12)) - (1+marketreturn(m1)(1+marketreturn(m2))---(1+marketreturn(m12)), where m1=closemonth-11, m2=closemonth-10, m3=closemonth-9, m4=closemonth-8, m5=closemonth-7, --- m12=closemonth
As shown in the excel sheet, the computed values in three different ways are different.
computed value by original definition above: 0.052
computed value by log and exponential: 0.023
computed value by current sas program: 0.388
It will be highly appreciative if you can give an idea how to fix program to generate the closest computed value by original definition (0.052).
data c4;
** Generate 12-month rolling benchmark returns **
** Do this only once and save in an array **;
if _n_=1 then do until (end_of_benchmark);
set benchmark end=end_of_benchmark;
array bmrk_ret {1990:2019,1:12} _temporary_ ;
array logplusone {12} _temporary_;
y=year(date);
m=month(date);
logplusone{m}=log(1+vwretd);
if n(of logplusone{*})=12 then bmrk_ret{y,m}=exp(sum(of logplusone{*}));
end;
set ch2;
by permno;
if first.permno then call missing(of logplusone{*});
m=month(date);
y=year(date);
logplusone{m}=log(1+ret);
if closemonth^=.;
if n(of logplusone{*})=12 then bhar=exp(sum(of logplusone{*})- bmrk_ret{y,m});
run;
Thank you
Joon1
It looks like a misplaced close parens:
Instead of
if n(of logplusone{*})=12 then bhar=exp(sum(of logplusone{*})- bmrk_ret{y,m});
bmrk_ret{y,m} was already exponentiated, so it should not be inside another EXP() function. Try this:
if n(of logplusone{*})=12 then bhar=exp(sum(of logplusone{*}))- bmrk_ret{y,m};
I've been mostly offline lately, so apologies for the tardy response.
Hi ChrisNZ,
Thanks for your comment
Could you please clarify your comment? I don't understand your comment.
Joon1
You start your question with:
Dear mkeniz,
which I assume means you directed your question to @mkeintz ?
It looks like a misplaced close parens:
Instead of
if n(of logplusone{*})=12 then bhar=exp(sum(of logplusone{*})- bmrk_ret{y,m});
bmrk_ret{y,m} was already exponentiated, so it should not be inside another EXP() function. Try this:
if n(of logplusone{*})=12 then bhar=exp(sum(of logplusone{*}))- bmrk_ret{y,m};
I've been mostly offline lately, so apologies for the tardy response.
Thank you so much, mkeintz. I greatly appreciate for your kind advice. Your code works well.
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!
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.