Hello everyone,
I require to run the difference in difference regression on panel data. Particularly, I need to examine the effect of CEO marital transition effect (from married to single) on the dividend payouts of the firm. I have provided the following details:
  • gvkey is the firm ID.
  • married is the dummy variable of the marital status of the CEO-- 1 is for the single and 0 is for the married
  • execid is the executive ID of the CEO
  • Dividends is the total dividends payout of the firm.
  • mtm is the Married to Married transition of the CEO
  • mts is the Married to Single transition of the CEO
I need to run the following regression:

Dividends= a+ b* post+ c*Post*treatment+d* Treatment+ controls

For that:
  • I need to create a dummy variable "Treatment" that equals 1 if a firm is a Married-to-Single CEO transition firm, and 0 if a firm is a Married-to-Married CEO transition firm
  • A variable "Post" which needs to be coded as 1 if a year is after a CEO transition, and 0 if a year is before a CEO transition.
  • An additional variable "Post1" specifying 2 years Pre and Post--or 3 Years window. I can change the period to see the change in effect if any)==> This is additional
  • The interaction of Treatment*Post.
Am I missing any other information that might be helpful for you to write the code? Please guide me.

Thanks in advance.



* Example generated by -dataex-. To install: ssc install dataex
clear
input long gvkey byte married int fyear long execid float dividends byte(mtm stm)
1004 0 1994 9248 7.65 0 0
1004 0 1995 9248 7.676 0 0
1004 0 1996 9249 7.976 1 0
1004 0 1997 9249 9.118 0 0
1004 0 1998 9249 9.375 0 0
1004 0 1999 9249 9.218 0 0
1004 0 2000 9249 9.157 0 0
1004 0 2001 9249 4.43 0 0
1004 0 2002 9249 .797 0 0
1004 0 2003 9249 0 0 0
1004 0 2004 9249 0 0 0
1004 0 2005 9249 0 0 0
1004 0 2006 9249 0 0 0
1004 0 2007 9249 0 0 0
1013 0 1993 6 0 0 0
1013 0 1994 6 0 0 0
1013 0 1995 6 0 0 0
1013 0 1996 6 0 0 0
1013 0 1997 6 0 0 0
1013 0 1998 6 0 0 0
1013 0 1999 6 0 0 0
1013 0 2000 6 0 0 0
1013 0 2001 22879 0 1 0
1013 0 2002 22879 0 0 0
1013 0 2003 22879 0 0 0
1013 0 2004 10203 0 1 0
1013 0 2005 10203 0 0 0
1013 0 2006 10203 0 0 0
1013 0 2007 10203 0 0 0
1013 0 2008 10203 0 0 0
1034 0 1993 6392 3.873 0 0
1034 0 1994 6390 3.893 1 0
1034 0 1995 6390 3.914 0 0
1034 0 1996 6390 3.928 0 0
1034 0 1997 6390 4.198 0 0
1034 0 1998 6390 4.651 0 0
1034 0 1999 16904 5.061 1 0
1034 1 2000 11170 6.526 0 1
1034 1 2001 11170 7.541 0 0
1034 1 2002 11170 9.235 0 0
1034 1 2003 11170 9.32 0 0
1034 1 2004 11170 9.404 0 0
1034 1 2005 11170 9.481 0 0
1034 0 2006 31853 9.84 0 0
1034 0 2007 31853 0 0 0
1045 0 1993 58 49 0 0
1045 0 1994 58 66 0 0
1045 0 1995 58 5 0 0
1045 0 1996 58 0 0 0
1045 0 1997 58 0 0 0
1045 0 1998 3661 0 1 0
1045 0 1999 3661 0 0 0
1045 0 2000 3661 0 0 0
1045 0 2001 3661 0 0 0
1045 0 2002 3661 0 0 0
1045 0 2003 14591 0 1 0
1045 0 2004 14591 0 0 0
1045 0 2005 14591 0 0 0
1045 0 2006 14591 0 0 0
1045 0 2007 14591 0 0 0
1045 0 2008 14591 0 0 0
1055 0 1993 79 0 0 0
1055 0 1994 79 0 0 0
1055 0 1995 79 0 0 0
1055 1 1996 2260 0 0 1
1056 0 1999 1891 0 0 0
1056 0 2000 1891 0 0 0
1056 0 2001 1891 0 0 0
1056 0 2002 1891 0 0 0
1056 0 2003 1891 0 0 0
1056 0 2004 1891 0 0 0
1056 0 2005 1891 0 0 0
1056 0 2006 1891 0 0 0
1072 0 2000 23167 24.463 0 0
1072 0 2001 23168 26.201 1 0
1072 0 2001 23168 26.201 0 0
1072 0 2002 23168 26.146 0 0
1072 0 2002 23168 26.146 0 0
1072 0 2003 23168 26.048 0 0
1072 0 2003 23168 26.048 0 0
1072 0 2004 23168 26.022 0 0
1072 0 2004 23168 26.022 0 0
1072 0 2005 23168 25.862 0 0
1072 0 2005 23168 25.862 0 0
1072 0 2006 23168 25.819 0 0
1072 0 2006 23168 25.819 0 0
1072 0 2007 23168 27.466 0 0
1072 0 2007 23168 27.466 0 0
1075 0 1993 759 17.466 0 0
1075 0 1994 759 72.115 0 0
1075 0 1995 759 80.855 0 0
1075 0 1996 759 89.614 0 0
1075 0 1997 759 96.16 0 0
1075 0 1998 759 103.849 0 0
1075 0 1999 10739 112.311 0 0
1075 0 2000 10739 120.733 0 0
1075 0 2001 10739 129.199 0 0
1075 0 2002 10739 137.721 1 0
1075 0 2003 10739 157.417 0 0
1075 0 2004 10739 166.772 0 0
end