/* A common question is how to compare abnormal returns between two samples, */
/* such as a test sample and a control sample. This example shows some ways to */
/* do this. This example does not address a control firm approach, where each */
/* test firm is matched to a specific control firm as a benchmark for the test */
/* firm's normal return. */
/* */
/* First we create SAS data set request files. Text request files could be used */
/* also. */
data control_sample;
infile datalines truncover;
input cusip:$8. EventDat:mmddyy10. EventNum:4.;
datalines;
01527110 4/24/2006 8001
01858110 10/15/2003 8002
09063H10 6/6/2005 8003
16776010 9/30/2003 8004
25848T10 8/8/2003 8005
27805810 12/14/2005 8006
29717810 8/28/2003 8007
31561610 9/16/2003 8008
34988210 3/23/2004 8009
40414L10 9/11/2006 8010
42709310 3/27/2006 8011
44746210 1/11/2006 8012
47110910 10/30/2006 8013
48300770 9/27/2006 8014
50239210 1/13/2004 8015
54927110 5/20/2004 8016
59161010 1/21/2003 8017
62937750 12/21/2005 8018
63110310 1/30/2006 8019
63862010 6/3/2003 8020
63890410 9/2/2003 8021
68190410 8/17/2005 8022
68218910 1/2/2004 8023
76027610 11/17/2005 8024
77669610 11/14/2003 8025
82028010 2/19/2004 8026
82967Y10 5/7/2004 8027
84546710 7/26/2005 8028
87154620 6/27/2005 8029
87959M10 4/9/2004 8030
90265310 1/25/2006 8031
92922P10 4/3/2006 8032
92923C10 11/12/2003 8033
98939010 6/16/2004 8034
98975W10 5/18/2006 8035
;
run;
data main_sample;
infile datalines truncover;
input cusip:$8. EventDat:mmddyy10. EventNum:4.;
datalines;
02493710 3/23/2004 9001
02493710 5/26/2005 9002
04004710 8/31/2006 9003
04621X10 1/10/2005 9004
05349910 7/18/2003 9005
15060220 6/7/2005 9006
16411R10 12/22/2003 9007
20576820 12/16/2003 9008
37940X10 3/17/2004 9009
39525910 4/15/2005 9010
40414L10 9/11/2006 9011
42217K10 5/12/2006 9012
45662V10 9/18/2003 9013
46033520 5/7/2003 9014
46069010 10/2/2003 9015
47110910 10/30/2006 9016
48887910 9/29/2006 9017
50419U20 11/14/2003 9018
55438210 1/12/2006 9019
62855J10 4/7/2005 9020
68190410 6/4/2003 9021
68668810 1/17/2006 9022
72607910 12/9/2005 9023
75281A10 6/21/2006 9024
75884910 5/20/2003 9025
81685110 2/4/2003 9026
84761M10 1/23/2004 9027
87296010 8/25/2005 9028
88023U10 11/9/2004 9029
90323610 1/27/2004 9030
92240G10 7/31/2003 9031
92532F10 4/1/2005 9032
92864510 11/13/2006 9033
95988E20 9/11/2003 9034
96638710 8/16/2004 9035
;
run;
/* The VPREFIX option selects a prefix for the variable names under which */
/* the window cumulative or buy-and-hold abnormal returns are stored in the */
/* OutWin data set. */
Eventus Page=Wide;
title 'Control Sample';
Request insas=work.control_sample CusiPerm AutoDate id=EventNum;
Windows (-2,+2);
Evtstudy vprefix=CumulativeAR Median Value NoSinglePeriod OutWin=work.controlcars;
Eventus Page=Wide;
title 'Main Sample';
Request insas=work.main_sample CusiPerm AutoDate id=EventNum;
Windows (-2,+2);
Evtstudy vprefix=CumulativeAR Median Value NoSinglePeriod OutWin=work.maincars;
/* This SAS data step combines the results from the two samples and creates a */
/* dummy variable Main, equal to 1 when a firm is in the main sample. The SAS */
/* data set option in= creates a temporary dummy variable that exists only */
/* during data step execution, so we have to use an assignment statement to */
/* create a variable that remains in the data set. */
data complete;
set maincars(in=in_main) controlcars;
Main=in_main;
run;
/* This step tests the unweighted mean difference in abnormal returns and */
/* cumulative abnormal returns between the two samples. */
/* */
/* The null is that (mean1-mean2)=0 where mean1 is the mean of the group having */
/* the smaller value of the class variable (main=0 in this example). The t-stat */
/* is negative in the output for this example, consistent with the negative */
/* point estimate of (mean1-mean2)=(control-main). */
/* */
/* If the Windows statement lists more than one window, a quick way to include */
/* all in the TTest procedure is to change CumulativeAR1 to CumulativeAR:. */
proc ttest data=complete;
title 'Equality of Means Tests (No Weight Variable Used)';
class main;
var CumulativeAR1;
run;
/* Another way to do the same thing is simple regression. The OLS t-stat is */
/* equal to the proc ttest t-stat for the equal-variance case, except for the */
/* sign (because Proc TTest tests control-main). */
SuperReg InSAS=complete id=EventNum model CumulativeAR1=main;
/* This step tests the weighted mean difference in abnormal returns and */
/* cumulative abnormal returns between the two samples. */
/* Consistent with the Patell test, The Weight statement weights each */
/* security-event inversely to the variance of the prediction error. */
proc ttest data=complete;
title 'Equality of Means Tests (Weight Variable Used)';
class main;
var CumulativeAR1;
weight car_weight1;
run;
/* If the Windows statement lists more than window, a separate TTest step is */
/* required for each window when the Weight statement is used. */
/* */
/* The SAS macro weighted_ttest repeats the PROC step for each of several */
/* CumulativeARs computed by a Windows statetement in Eventus. To use this, */
/* change the Windows statements to include the desired number of windows, */
/* run the two Eventus runs and the data complete; step, and change the 8 in */
/* the %do statement below to the acutal number of windows. */
/* */
/* The macro variable &i resolves to the window number in "CumulativeAR" and */
/* "car_weight". */
%macro weighted_ttest;
%do i=1 %to 8;
proc ttest data=complete;
class main;
var CumulativeAR&i;
weight car_weight&i;
run;
%end;
%mend;
/* %weighted_ttest;
Remove this line and the first two characters of the above line to use the macro */
Comments
4 comments
Hi Arnie, how does this differ if using non-CRSP data? Many thanks.
Thank you for the question. When using non-CRSP data, there is no difference in the parts that are specific to comparing CARs between samples. The elements specific to this purpose are:
1. The use of OutWin= on the EvtStudy statements
2. All the code beginning with the statement
data complete;
Hi Arnie,
I may be mistaken, but it seems like the valueweightsample option cannot be used in conjunction with the short-long option in EvtStudy statements. I believe the weights end up summing to 1 whereas it seems like the weights should sum to 0 (-1 for short side and 1 for long side).
The above code was very helpful though, and I was able to use the SAS proc ttest with the weight option to accomplish what I needed.
Regards,
Steven
It's not correct to infer that the portfolio weights sum to 1 when ValueWeightSample is used with a mixture of short and long positions (Short option). The value weights are applied to returns that have already been sign-reversed for short securities, producing negative portfolio weights.
However, good job bringing up the question whether the portfolio weights actually sum to zero. This is very timely as we recently added an option to ensure that exactly that happens. This is now documented at https://eventus.zendesk.com/knowledge/articles/360006202254/en-us?brand_id=257766.
Please sign in to leave a comment.