Hello!
I am trying to create a variable (Reconvicted) that takes on a value of 1 if a person has reconvicted a crime and 0 if they have not. Each offender in my dataset has a unique ID. The variable, "booking year" is the year that they were convicted (i.e., if a person has multiple booking years, they have been reconvicted of a crime). I was hoping that someone could please give me some pointers on how to do this. Thank you!
I am trying to create a variable (Reconvicted) that takes on a value of 1 if a person has reconvicted a crime and 0 if they have not. Each offender in my dataset has a unique ID. The variable, "booking year" is the year that they were convicted (i.e., if a person has multiple booking years, they have been reconvicted of a crime). I was hoping that someone could please give me some pointers on how to do this. Thank you!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long offenderid int bookingyear 21 2021 21 2021 21 2021 21 2021 21 1988 21 1988 21 1988 21 1988 21 1988 61 1991 61 1991 61 1991 70 1991 70 1991 70 1991 70 1991 70 1991 70 1991 70 1991 70 1991 70 1991 70 1991 70 1991 70 2018 70 2018 70 2018 70 2018 70 2018 70 2018 132 2017 132 2017 132 2017 132 2017 132 2017 132 2017 132 2023 148 2016 170 2021 246 2018 246 2018 246 2018 275 1992 275 1992 275 2019 275 2019 294 2016 294 2016 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 304 1987 332 2018 332 2018 345 2016 345 2016 345 2020 345 2019 345 2019 357 2017 357 2017 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 1993 357 2018 end
Comment