Hello,

I am currently analysing the impact of capital gains tax rate changes on innovation. In order to be able to create a synthetic control based on significant (2% or more) changes in the tax rate, I would like to generate a dummy variable which is 0 for years that have no change or a change by less than 2 in comparison to the year before and a 1 if the tax rate did change by more than 2. for context I have included below a sample of my data where id is a variable identifying the different countries and NetPersonalTax is the Net Personal Capital Gains tax rate. My whole data set spans 1170 observations from 36 countries with 38 years per country.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long id int year double NetPersonalTax
1 1981                 60
1 1982                 60
1 1983  60.41599999999999
1 1984                 61
1 1985                 61
1 1986             58.225
1 1987  2.450980392156879
1 1988 18.442622950819654
1 1989 16.803278688524586
1 1990 15.163934426229503
1 1991 15.163934426229503
1 1992 15.163934426229503
1 1993 22.985074626865675
1 1994 22.985074626865675
1 1995           19.53125
1 1996           19.84375
1 1997           19.53125
1 1998           19.53125
1 1999           19.53125
1 2000            21.9775
1 2001            26.4065
1 2002            26.4065
1 2003            26.4065
1 2004            26.4065
1 2005            26.4065
1 2006               23.6
1 2007          23.571429
1 2008          23.571429
1 2009          23.571429
1 2010            23.5485
1 2011            23.5485
1 2012            23.5485
1 2013            23.5485
1 2014             27.121
1 2015             27.121
1 2016             27.121
1 2017              24.28
1 2018              24.28
1 2019              24.28
2 1981                 62
2 1982                 62
2 1983                 62
2 1984                 62
2 1985                 62
2 1986                 31
2 1987                 31
2 1988                 31
2 1989                 25
2 1990                 25
2 1991                 25
2 1992                 25
2 1993                 25
2 1994                 22
2 1995                 22
2 1996                 25
2 1997                 25
2 1998                 25
2 1999                 25
2 2000                 25
2 2001                 25
2 2002                 25
2 2003                 25
2 2004                 25
2 2005                 25
2 2006                 25
2 2007                 25
2 2008                 25
2 2009                 25
2 2010                 25
2 2011                 25
2 2012                 25
2 2013                 25
2 2014                 25
2 2015                 25
2 2016               27.5
2 2017               27.5
2 2018               27.5
2 2019               27.5
3 1981 25.846153846153847
3 1982                 20
3 1983                 20
3 1984                 25
3 1985                 25
3 1986                 25
3 1987                 25
3 1988                 25
3 1989                 25
3 1990                 25
3 1991                 25
3 1992                 25
3 1993                 25
3 1994 13.390000000000002
3 1995 13.390000000000002
3 1996                 15
3 1997                 15
3 1998                 15
3 1999                 15
3 2000                 15
3 2001                 15
3 2002                 15
end
label values id id
label def id 1 "AUS", modify
label def id 2 "AUT", modify
label def id 3 "BEL", modify
I understand sometimes the change in tax rate is negative. in this case, I would like the dummy to still be 0 as I will create a second dummy variable only expressing the significant negative changes in tax rate.

Thank you in advance for your help,

Sincerely
Moritz