Hello everyone,
I am using Stata 18. have the following data (just a snapshot is below):
I will need to match it to another dataset over the period 2013-2021, using pc11_state_id & pc11_district_id.
I need to replicate rows for each cmiecode such that, the same rows recur from the year they appear in the above table.
So if a row has the year '2013', it will need to reappear from 2013-2021.
This may seem pointless for this file - but the file it will be matched to will have varying values for the same state & districts each year.
Please help if possible.
Thank you
I am using Stata 18. have the following data (just a snapshot is below):
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long cmiecode int year str2 pc11_state_id str3 pc11_district_id 113 2013 "27" "518" 113 2013 "27" "518" 113 2013 "27" "518" 113 2013 "27" "518" 113 2013 "27" "518" 171 2013 "07" "095" 362 2013 "30" "586" 362 2013 "30" "586" 600 2013 "09" "164" 600 2013 "09" "164" 600 2013 "09" "164" 600 2013 "09" "164" 600 2013 "09" "164" 600 2013 "09" "164" 600 2013 "09" "164" 600 2013 "09" "164" 600 2013 "09" "164" 725 2013 "28" "536" 780 2000 "19" "341" 780 2000 "19" "341" end
I need to replicate rows for each cmiecode such that, the same rows recur from the year they appear in the above table.
So if a row has the year '2013', it will need to reappear from 2013-2021.
This may seem pointless for this file - but the file it will be matched to will have varying values for the same state & districts each year.
Please help if possible.
Thank you
Comment