Hello Statalisters,
I am in dire need of help as I am unable to generate the time_to_treat variable needed in most event study packages. My dataset has two treatments Major and Minor and I have created the respective years of those treatments, I now need to generate the time variable relative to those treatments (Year_Minor and Year_Major)
input int year long fips float(Year_Minor Year_Major)
1991 1001 . .
1992 1001 . .
1993 1001 . .
1994 1001 . .
1995 1001 . .
1996 1001 . .
1997 1001 . .
1998 1001 . .
1999 1001 . .
2001 1001 . .
2002 1001 . .
2003 1001 . .
2004 1001 . .
2005 1001 . .
2008 1001 . .
2010 1001 . .
2014 1001 . .
2015 1001 . .
2016 1001 . .
2017 1001 . .
2018 1001 . .
2019 1001 . .
2020 1001 . .
2021 1001 . .
2022 1001 . .
2023 1001 . .
1991 1003 . .
1992 1003 . .
1993 1003 . .
1994 1003 . .
1995 1003 1995 .
1996 1003 . .
1997 1003 1997 .
1998 1003 1998 .
1999 1003 . .
2001 1003 . .
2002 1003 . .
2003 1003 . .
2004 1003 . 2004
2005 1003 2005 .
2008 1003 . .
2010 1003 . .
2014 1003 . .
2015 1003 . .
2016 1003 . .
2017 1003 . .
2018 1003 2018 .
2019 1003 . .
2020 1003 . 2020
2021 1003 . .
2022 1003 . .
2023 1003 . .
1991 1005 . .
1992 1005 . .
1993 1005 . .
1994 1005 . .
1995 1005 . .
1996 1005 . .
1997 1005 . .
1998 1005 . .
1999 1005 . .
2001 1005 . .
2002 1005 . .
2003 1005 . .
2004 1005 . .
2005 1005 . .
2008 1005 . .
2010 1005 . .
2014 1005 . .
2015 1005 . .
2016 1005 . .
2017 1005 . .
2018 1005 2018 .
2019 1005 . .
2020 1005 . .
2021 1005 . .
2022 1005 . .
2023 1005 . .
1991 1007 . .
1992 1007 . .
1993 1007 . .
1994 1007 . .
1995 1007 . .
1996 1007 . .
1997 1007 . .
1998 1007 . .
1999 1007 . .
2001 1007 . .
2002 1007 . .
2003 1007 . .
2004 1007 . .
2005 1007 . .
2008 1007 . .
2010 1007 . .
2014 1007 . .
2015 1007 . .
2016 1007 . .
2017 1007 . .
2018 1007 . .
2019 1007 . .
I am in dire need of help as I am unable to generate the time_to_treat variable needed in most event study packages. My dataset has two treatments Major and Minor and I have created the respective years of those treatments, I now need to generate the time variable relative to those treatments (Year_Minor and Year_Major)
input int year long fips float(Year_Minor Year_Major)
1991 1001 . .
1992 1001 . .
1993 1001 . .
1994 1001 . .
1995 1001 . .
1996 1001 . .
1997 1001 . .
1998 1001 . .
1999 1001 . .
2001 1001 . .
2002 1001 . .
2003 1001 . .
2004 1001 . .
2005 1001 . .
2008 1001 . .
2010 1001 . .
2014 1001 . .
2015 1001 . .
2016 1001 . .
2017 1001 . .
2018 1001 . .
2019 1001 . .
2020 1001 . .
2021 1001 . .
2022 1001 . .
2023 1001 . .
1991 1003 . .
1992 1003 . .
1993 1003 . .
1994 1003 . .
1995 1003 1995 .
1996 1003 . .
1997 1003 1997 .
1998 1003 1998 .
1999 1003 . .
2001 1003 . .
2002 1003 . .
2003 1003 . .
2004 1003 . 2004
2005 1003 2005 .
2008 1003 . .
2010 1003 . .
2014 1003 . .
2015 1003 . .
2016 1003 . .
2017 1003 . .
2018 1003 2018 .
2019 1003 . .
2020 1003 . 2020
2021 1003 . .
2022 1003 . .
2023 1003 . .
1991 1005 . .
1992 1005 . .
1993 1005 . .
1994 1005 . .
1995 1005 . .
1996 1005 . .
1997 1005 . .
1998 1005 . .
1999 1005 . .
2001 1005 . .
2002 1005 . .
2003 1005 . .
2004 1005 . .
2005 1005 . .
2008 1005 . .
2010 1005 . .
2014 1005 . .
2015 1005 . .
2016 1005 . .
2017 1005 . .
2018 1005 2018 .
2019 1005 . .
2020 1005 . .
2021 1005 . .
2022 1005 . .
2023 1005 . .
1991 1007 . .
1992 1007 . .
1993 1007 . .
1994 1007 . .
1995 1007 . .
1996 1007 . .
1997 1007 . .
1998 1007 . .
1999 1007 . .
2001 1007 . .
2002 1007 . .
2003 1007 . .
2004 1007 . .
2005 1007 . .
2008 1007 . .
2010 1007 . .
2014 1007 . .
2015 1007 . .
2016 1007 . .
2017 1007 . .
2018 1007 . .
2019 1007 . .
Comment