Dear Statalist Members,
I have a dataset at year-country level. Variable year stands for election years and it spans from 1961 to 2021 in the original dataset. However, since some years do not have election, these years do not appear in my dataset. These years are 1990, 1998, and 2010. I will merge this dataset (this one is my master dataset) with another dataset where data on 1990, 1992, and 2010 are available. I wish to generate years 1990, 1998 and 2010 for all countries where for example GADM_1 (i.e., region variable) is empty. By the way, I used the following command the expand the years: fillin yr ctr_n to fill the missing years. However, since 1990, 1992 and 2010 do not appear in the original dataset, even if I used "fillin" code, I still dont get 1990, 1992, and 2010.
Can you please help me?
Thank you very much.
I have a dataset at year-country level. Variable year stands for election years and it spans from 1961 to 2021 in the original dataset. However, since some years do not have election, these years do not appear in my dataset. These years are 1990, 1998, and 2010. I will merge this dataset (this one is my master dataset) with another dataset where data on 1990, 1992, and 2010 are available. I wish to generate years 1990, 1998 and 2010 for all countries where for example GADM_1 (i.e., region variable) is empty. By the way, I used the following command the expand the years: fillin yr ctr_n to fill the missing years. However, since 1990, 1992 and 2010 do not appear in the original dataset, even if I used "fillin" code, I still dont get 1990, 1992, and 2010.
Can you please help me?
Thank you very much.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str30 ctr_n double yr str26 GADM_1 "Angola" 2008 "Bengo" "Angola" 2008 "Bengo" "Angola" 2012 "Bengo" "Angola" 2012 "Bengo" "Angola" 2012 "Bengo" "Angola" 2008 "Bengo" "Angola" 2008 "Bengo" "Angola" 2012 "Bengo" "Angola" 2008 "Bengo" "Angola" 2008 "Bengo" "Angola" 2008 "Bengo" "Angola" 2008 "Bengo" "Angola" 2012 "Bengo" "Angola" 2008 "Bengo" "Angola" 2008 "Bengo" "Angola" 2012 "Bengo" "Angola" 2008 "Bengo" "Angola" 2012 "Bengo" "Angola" 2012 "Bengo" "Angola" 2012 "Bengo" "Angola" 2008 "Bengo" "Angola" 2008 "Bengo" "Angola" 2008 "Bengo" "Angola" 2012 "Benguela" "Angola" 2008 "Benguela" "Angola" 2008 "Benguela" "Angola" 2008 "Benguela" "Angola" 2008 "Benguela" "Angola" 2008 "Benguela" "Angola" 2012 "Benguela" "Angola" 2008 "Benguela" "Angola" 2008 "Benguela" "Angola" 2012 "Benguela" "Angola" 2012 "Benguela" "Angola" 2012 "Benguela" "Angola" 2008 "Benguela" "Angola" 2012 "Benguela" "Angola" 2012 "Benguela" "Angola" 2008 "Benguela" "Angola" 2008 "Benguela" "Angola" 2008 "Benguela" "Angola" 2008 "Benguela" "Angola" 2012 "Benguela" "Angola" 2008 "Benguela" "Angola" 2012 "Benguela" "Angola" 2008 "Benguela" "Angola" 2008 "Bie" "Angola" 2008 "Bie" "Angola" 2008 "Bie" "Angola" 2012 "Bie" "Angola" 2012 "Bie" "Angola" 2008 "Bie" "Angola" 2012 "Bie" "Angola" 2012 "Bie" "Angola" 2012 "Bie" "Angola" 2008 "Bie" "Angola" 2012 "Bie" "Angola" 2008 "Bie" "Angola" 2008 "Bie" "Angola" 2008 "Bie" "Angola" 2012 "Bie" "Angola" 2008 "Bie" "Angola" 2008 "Bie" "Angola" 2008 "Bie" "Angola" 2012 "Bie" "Angola" 2008 "Bie" "Angola" 2012 "Bie" "Angola" 2008 "Bie" "Angola" 2008 "Bie" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 2017 "Bengo" "Angola" 2017 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 2017 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 1992 "Bengo" "Angola" 2017 "Bengo" "Angola" 2017 "Bengo" "Angola" 2017 "Bengo" "Angola" 2017 "Bengo" "Angola" 1992 "Benguela" "Angola" 2017 "Benguela" "Angola" 1992 "Benguela" "Angola" 1992 "Benguela" "Angola" 1992 "Benguela" "Angola" 1992 "Benguela" end
Comment