Dear all,
I am currently working on my master’s thesis. I got a dataset with annual report data for around 20,000 firms for the 2012-2018 period. All the firms are operating in my home country. I am analyzing what is happening to a firm’s tax avoidance behavior if they change global ultimate owner. The change in global ultimate owner is my treatment effect.
I am using Stata/IC 16.0.
I want to create dummy variables relative to when the firm change global ultimate owner(ownership). Hence, dummy variables 3 years before until 3 years after the treatment took place. The year before treatment took place as reference year. It’s not all firms who change global ultimate owner in my sample, and I don’t know the year if will take place if they do.
Below I have shown an example of some parts of my dataset, which is important for my question. (got like 200 different variables).
I have shown firm id, annual report year and global ultimate owner (GUO). The GUO variable is a specific country code. So, the country code 21 is my home country and 23 is another country etc.
input int(id year) byte GUO
10001 2012 21
10001 2013 21
10001 2014 21
10001 2015 21
10001 2016 21
10001 2017 21
10001 2018 21
11200 2013 21
11200 2014 23
11200 2015 23
11200 2016 23
11200 2017 23
11200 2018 23
11222 2012 21
11222 2013 21
11222 2014 21
11222 2015 21
11222 2016 27
11222 2017 27
11222 2018 27
12000 2013 21
12000 2014 21
12000 2015 21
12000 2016 22
12000 2017 22
12000 2018 22
14000 2012 21
14000 2013 21
14000 2014 21
14000 2015 21
14000 2016 21
14000 2017 21
The variables diffminus3 indicates 3 years before the treatment took place and diffplus3 indicates 3 years after the treatment took place.
I would like my dataset to look something like this:
input int(id year) byte(GUO diffminus3 diffminus2 diffplus1 diffplus2 diffplus3)
10001 2012 21 0 0 0 0 0
10001 2013 21 0 0 0 0 0
10001 2014 21 0 0 0 0 0
10001 2015 21 0 0 0 0 0
10001 2016 21 0 0 0 0 0
10001 2017 21 0 0 0 0 0
10001 2018 21 0 0 0 0 0
11200 2013 21 0 0 0 0 0
11200 2014 23 0 0 0 0 0
11200 2015 23 0 0 1 0 0
11200 2016 23 0 0 0 1 0
11200 2017 23 0 0 0 0 1
11200 2018 23 0 0 0 0 0
11222 2012 21 0 0 0 0 0
11222 2013 21 1 0 0 0 0
11222 2014 21 0 1 0 0 0
11222 2015 21 0 0 0 0 0
11222 2016 27 0 0 0 0 0
11222 2017 27 0 0 1 0 0
11222 2018 27 0 0 0 1 0
12000 2013 21 1 0 0 0 0
12000 2014 21 0 1 0 0 0
12000 2015 21 0 0 0 0 0
12000 2016 22 0 0 0 0 0
12000 2017 22 0 0 1 0 0
12000 2018 22 0 0 0 1 0
14000 2012 21 0 0 0 0 0
14000 2013 21 0 0 0 0 0
14000 2014 21 0 0 0 0 0
14000 2015 21 0 0 0 0 0
14000 2016 21 0 0 0 0 0
14000 2017 21 0 0 0 0 0
I already tried to create these dummies myself.
The dummies for diffplus1 and diffplus2 looks something like this:
by id: gen idd=[_n]
bysort id (year) : gen differentplus1 = GUO != GUO[_n-2] | (_n == 1)
replace different2=0 if idd<=2
bysort id (year) : gen differentplus2 = GUO != GUO[_n-3] | (_n == 1)
replace different3=0 if idd<=3
However by this method I got problems creating the dummies before the treatment took place.
Thank you for your help.
0 Response to Dummies before and after random threatment took place
Post a Comment