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