I have two datasets below that will be used to run the regression.
The first dataset has the event date and the independent variable that will be included in the regression (permno is the company id). The second data includes the dependent variable and the corresponding data date. I would like to compute the average value of the dependent variable over the period starting the day of the event date (in the first dataset) and ending 25 trading days (or 30-calendar day is fine too) subsequent to the event date (in the first dataset). Eventually, I need to merge these two datasets and run the regression. Does anyone know how to do this?
Thank you for your help in advance!!
First dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float IndVar double permno long gvkey str8 event float event_date . 54594 1004 "03/20/02" 15419 . 54594 1004 "09/26/02" 15609 10.392 54594 1004 "12/18/03" 16057 8.699034 54594 1004 "03/17/04" 16147 8.769697 54594 1004 "09/17/03" 15965 7.417422 54594 1004 "03/16/05" 16511 10.286318 54594 1004 "12/17/04" 16422 8.470115 54594 1004 "09/22/04" 16336 7.532467 54594 1004 "06/29/04" 16251 8.017054 54594 1004 "07/13/05" 16630 10.202084 54594 1004 "12/22/05" 16792 9.199185 54594 1004 "09/21/05" 16700 9.664461 54594 1004 "03/22/06" 16882 9.297154 54594 1004 "09/20/06" 17064 8.514144 54594 1004 "07/12/06" 16994 9.904535 54594 1004 "12/20/06" 17155 9.301704 54594 1004 "03/21/07" 17246 8.781725 54594 1004 "12/18/07" 17518 9.319545 54594 1004 "03/18/08" 17609 8.617706 54594 1004 "07/11/07" 17358 7.401742 54594 1004 "09/19/07" 17428 8.119972 54594 1004 "03/17/09" 17973 8.989361 54594 1004 "12/16/08" 17882 9.495396 54594 1004 "07/09/08" 17722 8.742649 54594 1004 "09/17/08" 17792 8.927785 54594 1004 "07/14/09" 18092 7.412721 54594 1004 "09/22/09" 18162 7.624085 54594 1004 "12/15/09" 18246 8.5581255 54594 1004 "03/16/10" 18337 9.94263 54594 1004 "12/15/10" 18611 10.676916 54594 1004 "09/15/10" 18520 8.183745 54594 1004 "03/15/11" 18701 8.722836 54594 1004 "07/13/10" 18456 11.57164 54594 1004 "03/20/12" 19072 8.931377 54594 1004 "07/06/11" 18814 8.5629635 54594 1004 "12/15/11" 18976 9.034863 54594 1004 "09/15/11" 18885 7.23316 54594 1004 "07/17/12" 19191 8.845184 54594 1004 "09/19/12" 19255 7.951822 54594 1004 "03/19/13" 19436 9.33098 54594 1004 "12/18/12" 19345 7.532762 54594 1004 "09/24/13" 19625 7.237076 54594 1004 "07/25/13" 19564 8.344954 54594 1004 "03/20/14" 19802 8.06 54594 1004 "12/19/13" 19711 9.788443 54594 1004 "03/30/15" 20177 5.924142 54594 1004 "07/15/14" 19919 7.034337 54594 1004 "09/23/14" 19989 8.628414 54594 1004 "12/18/14" 20075 8.810369 54594 1004 "03/22/16" 20535 7.394891 54594 1004 "09/24/15" 20355 8.389315 54594 1004 "12/17/15" 20439 8.919166 54594 1004 "07/13/15" 20282 8.493516 54594 1004 "07/12/16" 20647 9.285281 54594 1004 "09/22/16" 20719 9.804967 54594 1004 "03/21/17" 20899 8.659197 54594 1004 "12/21/16" 20809 . 54594 1004 "07/11/17" 21011 . 21020 1045 "01/22/03" 15727 . 21020 1045 "07/17/02" 15538 . 21020 1045 "04/17/02" 15447 10.891432 21020 1045 "10/22/03" 16000 8.814521 21020 1045 "07/16/03" 15902 8.955702 21020 1045 "01/21/04" 16091 8.106686 21020 1045 "04/21/04" 16182 9.562162 21020 1045 "07/21/04" 16273 9.4517 21020 1045 "01/19/05" 16455 14.09584 21020 1045 "10/20/04" 16364 8.85817 21020 1045 "01/18/06" 16819 9.90615 21020 1045 "07/20/05" 16637 9.193802 21020 1045 "10/19/05" 16728 10.465582 21020 1045 "04/20/05" 16546 9.376605 21020 1045 "04/19/06" 16910 8.737447 21020 1045 "10/18/06" 17092 10.358104 21020 1045 "07/19/06" 17001 9.20968 21020 1045 "01/17/07" 17183 . 21020 1045 "07/18/07" 17365 10.852115 21020 1045 "10/17/07" 17456 10.076065 21020 1045 "01/16/08" 17547 9.816667 21020 1045 "04/18/07" 17274 10.265506 21020 1045 "10/15/08" 17820 9.7883 21020 1045 "01/21/09" 17918 10.55378 21020 1045 "07/16/08" 17729 11.644783 21020 1045 "04/16/08" 17638 7.961262 21020 1045 "10/21/09" 18191 10.361546 21020 1045 "01/20/10" 18282 9.42366 21020 1045 "07/15/09" 18093 8.978437 21020 1045 "04/15/09" 18002 10.269235 21020 1045 "04/21/10" 18373 10.082712 21020 1045 "07/21/10" 18464 11.44693 21020 1045 "10/20/10" 18555 10.293452 21020 1045 "01/19/11" 18646 9.540868 21020 1045 "10/19/11" 18919 9.144919 21020 1045 "07/20/11" 18828 11.044798 21020 1045 "04/20/11" 18737 7.99249 21020 1045 "01/28/14" 19751 10.062572 21020 1045 "10/23/14" 20019 9.471424 21020 1045 "07/24/14" 19928 10.154532 21020 1045 "01/27/15" 20115 8.819461 21020 1045 "04/24/14" 19837 end format %td event_date
Second dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double permno long data_date float DepVar 10001 12786 15.04574 10001 12787 .6763764 10001 12788 8.333333 10001 12789 . 10001 12792 28.673834 10001 12793 30.976736 10001 12794 0 10001 12795 30.19324 10001 12796 4.2328043 10001 12799 .3350434 10001 12800 0 10001 12801 2.3327112 10001 12802 . 10001 12803 3.0721965 10001 12806 30.976736 10001 12807 13.88889 10001 12808 5.509642 10001 12809 .8221352 10001 12810 .4140787 10001 12813 1.6563147 10001 12814 . 10001 12815 1.3874435 10001 12816 4.3010755 10001 12817 30.976736 10001 12820 7.309941 10001 12821 21.16402 10001 12822 .8162246 10001 12823 6.665833 10001 12824 30.976736 10001 12827 .8580009 10001 12828 6.613757 10001 12829 9.803922 10001 12830 27.77778 10001 12831 0 10001 12835 . 10001 12836 21.505375 10001 12837 30.976736 10001 12838 . 10001 12841 . 10001 12842 8.682295 10001 12843 . 10001 12844 . 10001 12845 . 10001 12848 . 10001 12849 10.752687 10001 12850 . 10001 12851 . 10001 12852 . 10001 12855 20.16129 10001 12856 . 10001 12857 2.688172 10001 12858 . 10001 12859 8.615935 10001 12862 5.760369 10001 12863 8.064516 10001 12864 . 10001 12865 20.16129 10001 12866 0 10001 12869 7.505176 10001 12870 . 10001 12871 1.5273705 10001 12872 . 10001 12873 21.505375 10001 12876 .3830515 10001 12877 . 10001 12878 . 10001 12879 . 10001 12880 6.458071 10001 12883 4.1407866 10001 12884 .4871514 10001 12885 0 10001 12886 30.976736 10001 12890 0 10001 12891 .431332 10001 12892 2.0135117 10001 12893 . 10001 12894 30.976736 10001 12897 0 10001 12898 30.976736 10001 12899 0 10001 12900 1.876294 10001 12901 1.3802623 10001 12904 30.30303 10001 12905 . 10001 12906 26.47709 10001 12907 2.0898643 10001 12908 20.20202 10001 12911 0 10001 12912 1.902441 10001 12913 30.976736 10001 12914 . 10001 12915 . 10001 12918 9.200009 10001 12919 4.386671 10001 12920 0 10001 12921 . 10001 12922 12.144012 10001 12925 . 10001 12926 . 10001 12927 . end format %d data_date
0 Response to Questions on event study and estimation window
Post a Comment