Hi everyone, I am asking your help in order to build a dummy variable for treated companies, useful to run a Diff in Diff. I am studying the effect of a CSR non-financial disclosure on Agency Costs of firms. I was able to generate the pre-post period treatment variable but now I have some troubles in generating the treatment dummy for companies that in 2016 or 2017 or 2018 apply the CSR policy.
I know that despite policy it's generically implemented from 2017 onwards (2016 for Estonia and Greece and 2018 for Spain), I need a dummy which equals 1 for all the sample period (so even for year 2014,2015 and 2016) for treated countries.
I am using the following formula but I realized that in some cases the result is not the right one because it is possible that the policy it's applied just in one year and then not anymore (parameters for application concern the average number of employees in a year). So I need something that returns 1 for all the interval period 2014-2019 when at least in one year policy was applied in the firm.
How can I do that?
This is the formula I am using but I guess it's not completely correct: bysort CountryofIncorporation ID (YEAR): replace CSR = 1 if CSR==0 & CSR[_N]==1
Thanks for the help!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str109 CompanyName str11 CountryofIncorporation int YEAR float(AgencyCost_Assets dummyT CSR InteractionDID) "Agrana Beteiligungs AG" "Austria" 2015 1.0359905 0 0 0 "Agrana Beteiligungs AG" "Austria" 2016 1.1045318 0 0 0 "Agrana Beteiligungs AG" "Austria" 2017 1.0321829 1 1 1 "Agrana Beteiligungs AG" "Austria" 2018 1.089074 1 1 1 "Agrana Beteiligungs AG" "Austria" 2019 1.0224495 1 1 1 "AMAG Austria Metall AG" "Austria" 2014 .7561717 0 0 0 "AMAG Austria Metall AG" "Austria" 2015 .8270431 0 0 0 "AMAG Austria Metall AG" "Austria" 2016 .6521036 0 0 0 "AMAG Austria Metall AG" "Austria" 2017 .7376047 1 1 1 "AMAG Austria Metall AG" "Austria" 2018 .7055686 1 1 1 "AMAG Austria Metall AG" "Austria" 2019 .709861 1 1 1 "ams AG" "Austria" 2014 .48626965 0 0 0 "ams AG" "Austria" 2015 .5093262 0 0 0 "ams AG" "Austria" 2016 .3864685 0 0 0 "ams AG" "Austria" 2017 .3261792 1 1 1 "ams AG" "Austria" 2018 .3979056 1 1 1 "ams AG" "Austria" 2019 .4252402 1 1 1 "Andritz AG" "Austria" 2014 .9773194 0 0 0 "Andritz AG" "Austria" 2015 1.1037016 0 0 0 "Andritz AG" "Austria" 2016 .97425 0 0 0 "Andritz AG" "Austria" 2017 .9399393 1 1 1 "Andritz AG" "Austria" 2018 .871771 1 1 1 "Andritz AG" "Austria" 2019 .9225614 1 1 1 "AT & S Austria Technologie & Systemtechnik AG" "Austria" 2014 .643964 0 0 0 "AT & S Austria Technologie & Systemtechnik AG" "Austria" 2015 .54636586 0 0 0 "AT & S Austria Technologie & Systemtechnik AG" "Austria" 2016 .5673439 0 0 0 "AT & S Austria Technologie & Systemtechnik AG" "Austria" 2017 .5672092 1 1 1 "AT & S Austria Technologie & Systemtechnik AG" "Austria" 2018 .6480774 1 1 1 "AT & S Austria Technologie & Systemtechnik AG" "Austria" 2019 .5761894 1 1 1 "Athos Immobilien AG" "Austria" 2016 .09226921 0 0 0 "Athos Immobilien AG" "Austria" 2017 .09088276 1 0 0 "Athos Immobilien AG" "Austria" 2018 .09001458 1 0 0 "Athos Immobilien AG" "Austria" 2019 .08367804 1 0 0 "Burgenland Holding AG" "Austria" 2014 0 0 0 0 "Burgenland Holding AG" "Austria" 2015 0 0 0 0 "Burgenland Holding AG" "Austria" 2016 0 0 0 0 "Burgenland Holding AG" "Austria" 2017 0 1 0 0 "Burgenland Holding AG" "Austria" 2018 .00012560148 1 0 0 "Burgenland Holding AG" "Austria" 2019 0 1 0 0 "CA Immobilien Anlagen AG" "Austria" 2014 .0550363 0 0 0 "CA Immobilien Anlagen AG" "Austria" 2015 .05296383 0 0 0 "CA Immobilien Anlagen AG" "Austria" 2016 .05246661 0 0 0 "CA Immobilien Anlagen AG" "Austria" 2017 .05108768 1 0 0 "CA Immobilien Anlagen AG" "Austria" 2018 .0486253 1 0 0 "CA Immobilien Anlagen AG" "Austria" 2019 .04771639 1 0 0 "DO & CO AG" "Austria" 2014 1.239242 0 0 0 "DO & CO AG" "Austria" 2015 1.351606 0 0 0 "DO & CO AG" "Austria" 2016 1.459347 0 0 0 "DO & CO AG" "Austria" 2017 1.4699473 1 1 1 "DO & CO AG" "Austria" 2018 1.503071 1 1 1 "DO & CO AG" "Austria" 2019 1.4405873 1 1 1 "EVN AG" "Austria" 2015 .328524 0 0 0 "EVN AG" "Austria" 2016 .3121482 0 0 0 "EVN AG" "Austria" 2017 .3432431 1 1 1 "EVN AG" "Austria" 2018 .26544163 1 1 1 "EVN AG" "Austria" 2019 .26915467 1 1 1 "Fabasoft AG" "Austria" 2014 .9129975 0 0 0 "Fabasoft AG" "Austria" 2015 .978932 0 0 0 "Fabasoft AG" "Austria" 2019 .7771518 1 0 0 "FACC AG" "Austria" 2014 .9614663 0 0 0 "FACC AG" "Austria" 2015 .7363977 0 0 0 "FACC AG" "Austria" 2016 .8726558 0 0 0 "FACC AG" "Austria" 2017 1.0296525 1 1 1 "FACC AG" "Austria" 2018 1.0625663 1 1 1 "FACC AG" "Austria" 2019 .8864281 1 1 1 "Flughafen Wien AG" "Austria" 2014 .3330248 0 0 0 "Flughafen Wien AG" "Austria" 2015 .33176735 0 0 0 "Flughafen Wien AG" "Austria" 2016 .3674309 0 0 0 "Flughafen Wien AG" "Austria" 2017 .3650937 1 1 1 "Flughafen Wien AG" "Austria" 2018 .3705393 1 1 1 "Flughafen Wien AG" "Austria" 2019 .3727733 1 1 1 "Frauenthal Holding AG" "Austria" 2014 1.708831 0 0 0 "Frauenthal Holding AG" "Austria" 2015 1.9760165 0 0 0 "Frauenthal Holding AG" "Austria" 2016 2.1863856 0 0 0 "Frauenthal Holding AG" "Austria" 2017 2.1635895 1 1 1 "Frauenthal Holding AG" "Austria" 2018 2.3392391 1 1 1 "Frauenthal Holding AG" "Austria" 2019 2.1511493 1 1 1 "Frequentis AG" "Austria" 2014 1.5880376 0 0 0 "Frequentis AG" "Austria" 2015 1.591476 0 0 0 "Frequentis AG" "Austria" 2016 1.3725097 0 0 0 "Frequentis AG" "Austria" 2017 1.41069 1 1 1 "Frequentis AG" "Austria" 2018 1.4844916 1 1 1 "Frequentis AG" "Austria" 2019 1.1400046 1 1 1 "Hutter & Schrantz Stahlbau AG" "Austria" 2014 1.2100103 0 0 0 "Hutter & Schrantz Stahlbau AG" "Austria" 2015 1.1128067 0 0 0 "Immofinanz AG" "Austria" 2014 .06504148 0 0 0 "Immofinanz AG" "Austria" 2015 .05618835 0 0 0 "Immofinanz AG" "Austria" 2016 .03097149 0 0 0 "Immofinanz AG" "Austria" 2017 .05350833 1 0 0 "Immofinanz AG" "Austria" 2018 .05717643 1 0 0 "Immofinanz AG" "Austria" 2019 .057424 1 0 0 "Josef Manner & Comp AG" "Austria" 2014 1.5359948 0 0 0 "Josef Manner & Comp AG" "Austria" 2015 1.39001 0 0 0 "Josef Manner & Comp AG" "Austria" 2016 1.3905193 0 0 0 "Josef Manner & Comp AG" "Austria" 2017 1.419019 1 1 1 "Josef Manner & Comp AG" "Austria" 2018 1.4994643 1 1 1 "Josef Manner & Comp AG" "Austria" 2019 1.526918 1 1 1 "Kapsch Trafficcom AG" "Austria" 2014 .8591163 0 0 0 "Kapsch Trafficcom AG" "Austria" 2015 .8851436 0 0 0 "Kapsch Trafficcom AG" "Austria" 2016 1.0241873 0 0 0 end
0 Response to Constructing dummy for treated firms in a diff in diff
Post a Comment