I have a dataset looking as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year float id_indication str83 IndicationName float(treated launch_year_first_cell) double prod_ann_sales 2015 1 "Abdominal aortic aneurysm" 0 . 0 2016 1 "Abdominal aortic aneurysm" 0 . 0 2017 1 "Abdominal aortic aneurysm" 0 . 0 2018 1 "Abdominal aortic aneurysm" 0 . 0 2019 1 "Abdominal aortic aneurysm" 0 . 0 2020 1 "Abdominal aortic aneurysm" 0 . 0 2021 1 "Abdominal aortic aneurysm" 0 . 0 2022 1 "Abdominal aortic aneurysm" 0 . 0 2023 1 "Abdominal aortic aneurysm" 0 . 21.8633333333333 2024 1 "Abdominal aortic aneurysm" 0 . 53.7966666666667 2025 1 "Abdominal aortic aneurysm" 0 . 84.28 2026 1 "Abdominal aortic aneurysm" 0 . 113.393333333333 2015 2 "Achondroplasia" 2016 1163.23574203499 2016 2 "Achondroplasia" 2016 1303.2157934352 2017 2 "Achondroplasia" 2016 1011.17575275825 2018 2 "Achondroplasia" 2016 1083.2157251451 2019 2 "Achondroplasia" 2016 1090.82350163661 2020 2 "Achondroplasia" 2016 1179.97440868719 2021 2 "Achondroplasia" 2016 1223.9224860606562 2022 2 "Achondroplasia" 2016 1293.0416237264178 2023 2 "Achondroplasia" 2016 1420.8981733000492 2024 2 "Achondroplasia" 2016 1589.9391177204116 2025 2 "Achondroplasia" 2016 1852.242825747795 2026 2 "Achondroplasia" 2016 2098.367633202445 2015 3 "Acid-related dyspepsia" 0 . 385.5409559772426 2016 3 "Acid-related dyspepsia" 0 . 355.6929774027395 2017 3 "Acid-related dyspepsia" 0 . 381.41060827522364 2018 3 "Acid-related dyspepsia" 0 . 386.799461705437 2019 3 "Acid-related dyspepsia" 0 . 300.476492474147 2020 3 "Acid-related dyspepsia" 0 . 202.49361787399036 2021 3 "Acid-related dyspepsia" 0 . 228.90110325097507 2022 3 "Acid-related dyspepsia" 0 . 226.16186369057772 2023 3 "Acid-related dyspepsia" 0 . 222.00651822704063 2024 3 "Acid-related dyspepsia" 0 . 217.66185051459985 2025 3 "Acid-related dyspepsia" 0 . 214.727676749817 2026 3 "Acid-related dyspepsia" 0 . 212.26663479235557 2015 4 "Acne" 0 . 2258.063099020268 2016 4 "Acne" 0 . 1966.7606963581804 2017 4 "Acne" 0 . 1801.770638404245 2018 4 "Acne" 0 . 1678.2880184673706 2019 4 "Acne" 0 . 1575.2476318817926 2020 4 "Acne" 0 . 1570.7339948396063 2021 4 "Acne" 0 . 1646.9662555222505 2022 4 "Acne" 0 . 1732.2217298349751 2023 4 "Acne" 0 . 1866.0471322873602 2024 4 "Acne" 0 . 1987.9143855539958 2025 4 "Acne" 0 . 2083.4991115826656 2026 4 "Acne" 0 . 2206.484618818403 2015 5 "Acromegaly" 0 . 1998.6214246220125 2016 5 "Acromegaly" 0 . 2072.6613134891177 2017 5 "Acromegaly" 0 . 2069.2273626703222 2018 5 "Acromegaly" 0 . 2019.5289616017235 2019 5 "Acromegaly" 0 . 2041.3132067482168 2020 5 "Acromegaly" 0 . 2014.163795738852 2021 5 "Acromegaly" 0 . 1951.3060433715675 2022 5 "Acromegaly" 0 . 1794.5447511705975 2023 5 "Acromegaly" 0 . 1609.8826430457325 2024 5 "Acromegaly" 0 . 1500.0167300613577 2025 5 "Acromegaly" 0 . 1461.306107095164 2026 5 "Acromegaly" 0 . 1444.0853372727947 2015 6 "Actinic keratosis" 0 . 375.3044829091662 2016 6 "Actinic keratosis" 0 . 197.96140632044785 2017 6 "Actinic keratosis" 0 . 213.5143751056571 2018 6 "Actinic keratosis" 0 . 267.6492265368961 2019 6 "Actinic keratosis" 0 . 180.28720943686253 2020 6 "Actinic keratosis" 0 . 78.45472173605228 2021 6 "Actinic keratosis" 0 . 93.9275036119191 2022 6 "Actinic keratosis" 0 . 113.62612510585552 2023 6 "Actinic keratosis" 0 . 145.7289865973963 2024 6 "Actinic keratosis" 0 . 179.10831358747976 2025 6 "Actinic keratosis" 0 . 208.14323503324482 2026 6 "Actinic keratosis" 0 . 241.98066014984138 2015 7 "Acute Radiation Syndrome" 2011 1049 2016 7 "Acute Radiation Syndrome" 2011 765 2017 7 "Acute Radiation Syndrome" 2011 549 2018 7 "Acute Radiation Syndrome" 2011 365 2019 7 "Acute Radiation Syndrome" 2011 264 2020 7 "Acute Radiation Syndrome" 2011 225 2021 7 "Acute Radiation Syndrome" 2011 133.062166233333 2022 7 "Acute Radiation Syndrome" 2011 107.064829816667 2023 7 "Acute Radiation Syndrome" 2011 95.3222947833333 2024 7 "Acute Radiation Syndrome" 2011 86.0040361884058 2025 7 "Acute Radiation Syndrome" 2011 75.1362600124134 2026 7 "Acute Radiation Syndrome" 2011 66.6616121581944 2015 8 "Acute decompensated heart failure (ADHF)" 0 . 0 2016 8 "Acute decompensated heart failure (ADHF)" 0 . 0 2017 8 "Acute decompensated heart failure (ADHF)" 0 . 0 2018 8 "Acute decompensated heart failure (ADHF)" 0 . 0 2019 8 "Acute decompensated heart failure (ADHF)" 0 . 0 2020 8 "Acute decompensated heart failure (ADHF)" 0 . 0 2021 8 "Acute decompensated heart failure (ADHF)" 0 . 0 2022 8 "Acute decompensated heart failure (ADHF)" 0 . 0 2023 8 "Acute decompensated heart failure (ADHF)" 0 . 1.25 2024 8 "Acute decompensated heart failure (ADHF)" 0 . 4 2025 8 "Acute decompensated heart failure (ADHF)" 0 . 8.5 2026 8 "Acute decompensated heart failure (ADHF)" 0 . 13 2015 9 "Acute kidney injury" 0 . 0 2016 9 "Acute kidney injury" 0 . 0 2017 9 "Acute kidney injury" 0 . 0 2018 9 "Acute kidney injury" 0 . 0 end
1) make a diff in diff that is suited for balanced panel with different treatment periods;
2) make pre-post plot where I have an xline on the normalized treatment period, treated and control units (i.e. a normal plot of diff in diff with normalized years instead, say 0 = treatment period, negative periods are periods before treatment and positive periods are periods after treatment).
Is it possible to do soo in Stata 13?
Thank you,
Federico
0 Response to Diff in Diff in balanced panel with multiple treatment periods
Post a Comment