Dear Statalist experts,
I would like to post a question. Below is a part of my panel data (xtset firm_id month). There is an intervention happening in month 4, which affects UK firms. So I have "treated" = 1 for UK firms, and = 0 for non-EU firms. My goal to test the effect of this intervention on the variable "esg", specifically pinpointing when the effect began for treated firms. So I want to pick month 4 as baseline, and aim to observe the effect in each month (instead of just creating a dummy time variable = 1 for post-intervention and 0 for pre-intervention). I also include country and time fixed-effects.
Could you please help me with the relevant codes? I have tried several codes but not sure which one is correct. I understand that I can create dummy variables for each month, but that would make the interactions complex (e.g., month_dummy*treated).
Also, what is the difference if I use xtset and reghdfe?
I am hoping for your assistance. Thank you very much.
I would like to post a question. Below is a part of my panel data (xtset firm_id month). There is an intervention happening in month 4, which affects UK firms. So I have "treated" = 1 for UK firms, and = 0 for non-EU firms. My goal to test the effect of this intervention on the variable "esg", specifically pinpointing when the effect began for treated firms. So I want to pick month 4 as baseline, and aim to observe the effect in each month (instead of just creating a dummy time variable = 1 for post-intervention and 0 for pre-intervention). I also include country and time fixed-effects.
Could you please help me with the relevant codes? I have tried several codes but not sure which one is correct. I understand that I can create dummy variables for each month, but that would make the interactions complex (e.g., month_dummy*treated).
Also, what is the difference if I use xtset and reghdfe?
I am hoping for your assistance. Thank you very much.
Code:
input str10 firm_id byte month str14 country float esg byte treated "FS00008NOQ" 1 "Germany" 22.29 0 "FS00008NOQ" 2 "Germany" 22.36 0 "FS00008NOQ" 3 "Germany" 22.55 0 "FS00008NOQ" 4 "Germany" 22.58 0 "FS00008NOQ" 5 "Germany" 22.54 0 "FS00008NOQ" 6 "Germany" 22.77 0 "FS00008NOQ" 7 "Germany" 23.16 0 "FS00008WGQ" 1 "Germany" 20.03 0 "FS00008WGQ" 2 "Germany" 19.9 0 "FS00008WGQ" 3 "Germany" 20.84 0 "FS00008WGQ" 4 "Germany" 20.75 0 "FS00008WGQ" 5 "Germany" 20.77 0 "FS00008WGQ" 6 "Germany" 20.78 0 "FS00008WGQ" 7 "Germany" 19.38 0 "FS00008N1D" 1 "Austria" 22.94 0 "FS00008N1D" 2 "Austria" 22.66 0 "FS00008N1D" 3 "Austria" 23.38 0 "FS00008N1D" 4 "Austria" 23.34 0 "FS00008N1D" 5 "Austria" 23.24 0 "FS00008N1D" 6 "Austria" 23.08 0 "FS00008N1D" 7 "Austria" 22.92 0 "FS00008LRJ" 3 "France" 25.22 0 "FS00008LRJ" 4 "France" 24.98 0 "FS00008LRJ" 5 "France" 24.5 0 "FS00008LRJ" 6 "France" 24.74 0 "FS00008LRJ" 7 "France" 25.56 0 "FS0000DCP4" 1 "Italy" 23.85 0 "FS0000DCP4" 2 "Italy" 23.74 0 "FS0000DCP4" 3 "Italy" 24.83 0 "FS0000DCP4" 4 "Italy" 24.78 0 "FS0000DCP4" 5 "Italy" 24.86 0 "FS0000DCP4" 6 "Italy" 24.57 0 "FS0000DCP4" 7 "Italy" 24.24 0 "FS00009EMM" 1 "Spain" 23.57 0 "FS00009EMM" 2 "Spain" 23.46 0 "FS00009EMM" 3 "Spain" 24.57 0 "FS00009EMM" 4 "Spain" 24.55 0 "FS00009EMM" 5 "Spain" 24.56 0 "FS00009EMM" 6 "Spain" 24.34 0 "FS00009EMM" 7 "Spain" 24.52 0 "FSGBR05750" 1 "United Kingdom" 23.83 1 "FSGBR05750" 2 "United Kingdom" 23.8 1 "FSGBR05750" 3 "United Kingdom" 23.93 1 "FSGBR05750" 4 "United Kingdom" 23.55 1 "FSGBR05750" 5 "United Kingdom" 23.48 1 "FSGBR05750" 6 "United Kingdom" 23.33 1 "FSGBR05750" 7 "United Kingdom" 22.34 1 "FS0000BPTE" 1 "United Kingdom" 23.86 1 "FS0000BPTE" 2 "United Kingdom" 23.44 1 "FS0000BPTE" 3 "United Kingdom" 24.26 1 "FS0000BPTE" 4 "United Kingdom" 24.12 1 "FS0000BPTE" 5 "United Kingdom" 24.18 1 "FS0000BPTE" 6 "United Kingdom" 23.9 1 "FS0000BPTE" 7 "United Kingdom" 23.52 1 "FS0000EG0J" 1 "United Kingdom" 23.84 1 "FS0000EG0J" 2 "United Kingdom" 23.76 1 "FS0000EG0J" 3 "United Kingdom" 24.29 1 "FS0000EG0J" 4 "United Kingdom" 24.32 1 "FS0000EG0J" 5 "United Kingdom" 24.16 1 "FS0000EG0J" 6 "United Kingdom" 23.84 1 "FS0000EG0J" 7 "United Kingdom" 23.59 1 "FS0000CLMN" 1 "United Kingdom" 24.41 1 "FS0000CHAG" 1 "United Kingdom" 25.94 1 "FS0000CHAG" 2 "United Kingdom" 25.75 1 "FS0000CHAG" 3 "United Kingdom" 26.33 1 "FS0000CHAG" 4 "United Kingdom" 26.42 1 "FS0000CHAG" 5 "United Kingdom" 26.29 1 "FS0000CHAG" 6 "United Kingdom" 26.16 1 "FS0000CHAG" 7 "United Kingdom" 26.19 1 "FSGBR059ON" 1 "United Kingdom" 25.13 1 "FSGBR059ON" 2 "United Kingdom" 25.03 1 "FSGBR059ON" 3 "United Kingdom" 25.93 1 "FSGBR059ON" 4 "United Kingdom" 25.83 1 "FSGBR059ON" 5 "United Kingdom" 25.74 1 "FSGBR059ON" 6 "United Kingdom" 25.51 1 "FSGBR059ON" 7 "United Kingdom" 25.28 1 "FS0000FHDL" 1 "United Kingdom" 29.95 1 "FS0000FHDL" 2 "United Kingdom" 29.84 1 "FS0000FHDL" 3 "United Kingdom" 30.32 1 "FS0000FHDL" 4 "United Kingdom" 30.62 1 "FS0000FHDL" 5 "United Kingdom" 30.6 1 "FS0000FHDL" 6 "United Kingdom" 30.45 1 "FS0000FHDL" 7 "United Kingdom" 30.6 1 "FSUSA0A8KV" 1 "United Kingdom" 28.84 1 "FSUSA0A8KV" 2 "United Kingdom" 28.83 1 "FSUSA0A8KV" 3 "United Kingdom" 29.58 1 "FSUSA0A8KV" 4 "United Kingdom" 29.78 1 "FSUSA0A8KV" 5 "United Kingdom" 29.74 1 "FSUSA0A8KV" 6 "United Kingdom" 29.4 1 "FSUSA0A8KV" 7 "United Kingdom" 29.94 1
Comment