Code:
* Example generated by -dataex-. For more info, type help dataex clear input float year long unique_id double cooking_fuel 2015 10001001 3 2016 10001001 3 2017 10001001 3 2018 10001001 3 2019 10001001 10 2020 10001001 10 2018 10001002 3 2019 10001002 2 2017 10001003 1 2018 10001003 3 2019 10001003 2 2020 10001003 2 2021 10001003 2 2015 10001004 3 2019 10001004 2 2020 10001004 2 2021 10001004 2 2018 10001006 3 2019 10001006 10 2020 10001006 10 2021 10001006 2 2017 10001007 3 2018 10001007 3 2019 10001007 2 2020 10001007 2 2021 10001007 2 2018 10001008 6 2019 10001008 10 2020 10001008 10 2021 10001008 8 end
Hello everyone,
In my unbalanced panel dataset, I have a categorical variable named cooking_fuel representing different types of cooking fuels. Between 2015 and 2018, the values 5 or 6 denote clean fuel. Similarly, for the years 2019-2020, values 8, 9, 10, or 11 indicate clean fuel. Finally, in 2021, clean fuel is represented by values 6, 7, 8, or 9. Additionally, the variable ranges from 1 to 11, covering all possible fuel types.
Now, I aim to categorize households (identified by unique_id) into two groups while dropping others:
- The first group comprises households that never used clean energy throughout any year in the dataset. (Easy to make)
- The second group consists of households that started using clean energy from 2016 onwards but never reverted back to dirty energy (excluding clean energy) thereafter.
Thank you.
Comment