Hi all,
I have the following equation:

where D is a dummy variable which equals 1 if an individual was born in December and 0 if he/she was born in January of the following year; Z is the month of birth, sorted for a time window from February of a year to November of the following year; c is the threshold at January in that window; and I is a dummy variable indicating whether the individual was born from January onward.
I want to generate the following variables: D, Z, c, and I. I would greatly appreciate it if anyone could help me out. For simplicity, please ignore subscripts i and j for now. Thanks!
Data example
I have the following equation:
where D is a dummy variable which equals 1 if an individual was born in December and 0 if he/she was born in January of the following year; Z is the month of birth, sorted for a time window from February of a year to November of the following year; c is the threshold at January in that window; and I is a dummy variable indicating whether the individual was born from January onward.
I want to generate the following variables: D, Z, c, and I. I would greatly appreciate it if anyone could help me out. For simplicity, please ignore subscripts i and j for now. Thanks!
Data example
Code:
clear input byte month int year 1 2016 8 2017 8 2018 2 2016 3 2017 8 2019 7 2017 8 2016 11 2020 4 2018 8 2018 10 2017 9 2020 7 2019 8 2020 11 2019 2 2016 5 2019 5 2020 5 2018 3 2017 6 2017 3 2016 1 2020 1 2020 11 2019 11 2015 11 2015 7 2015 10 2019 1 2020 6 2016 9 2015 1 2016 12 2019 3 2020 11 2020 11 2015 12 2015 12 2017 4 2020 3 2020 2 2019 7 2020 10 2017 7 2019 8 2020 8 2018 4 2019 12 2019 8 2018 4 2017 5 2018 7 2017 6 2017 3 2016 9 2018 9 2017 3 2015 4 2018 5 2017 5 2016 1 2016 11 2016 8 2019 7 2019 1 2016 5 2019 10 2017 10 2015 7 2020 10 2016 9 2016 7 2020 2 2020 12 2015 2 2019 7 2018 6 2020 4 2016 6 2016 10 2019 3 2017 12 2017 12 2018 2 2017 6 2019 6 2019 4 2017 3 2018 2 2017 9 2020 12 2015 12 2016 9 2017 9 2018 9 2016 7 2018 end label values month labels12 label def labels12 1 "JANUARY", modify label def labels12 2 "FEBRUARY", modify label def labels12 3 "MARCH", modify label def labels12 4 "APRIL", modify label def labels12 5 "MAY", modify label def labels12 6 "JUNE", modify label def labels12 7 "JULY", modify label def labels12 8 "AUGUST", modify label def labels12 9 "SEPTEMBER", modify label def labels12 10 "OCTOBER", modify label def labels12 11 "NOVEMBER", modify label def labels12 12 "DECEMBER", modify label values year labels13
Comment