Hello,


I show you an example of the dataset that I have:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int year long gid int country_code float nactors2
1997 137172 566 1
1997 145095 566 1
1998 137172 566 3
1998 145095 566 3
1999 145095 566 2
2000 145095 566 3
2001 145095 566 2
2002 145095 566 3
2003 137172 566 2
2003 145095 566 1
2004 137172 566 4
2004 145095 566 1
2006 137172 566 1
2007 137172 566 2
2007 145095 566 1
2008 137172 566 1
2009 137172 566 2
2009 145095 566 1
2010 137172 566 4
2010 145095 566 1
2011 137172 566 1
2011 145095 566 4
2012 137172 566 1
2012 145095 566 6
2013 137172 566 1
2013 145095 566 3
2014 145095 566 4
2015 145095 566 2
2016 137172 566 5
2016 145095 566 2
2017 137172 566 6
2017 145095 566 3
2018 137172 566 7
2018 145095 566 2
2019 137172 566 6
2019 145095 566 2
2020 137172 566 5
2020 145095 566 6
end

I give as an example two regions, given by variable gid. One is 137172 and the other 145095. I have data from 1997 to 2020. However, for some that regions some years are missing. For example, when the region is gid = 145095, years 2005, 2006 or 2008 are missing. For gid = 137172, others regions are missing.

Given that, I would like to get the missing values using an interpolation methods, taking into account the regions. In other others, if the years 2006 and 2008 are missing for regions 137172, I would like to get that data using the data that region.

I put as an example two regions, but I have much more.

Do you know what interpolation method can I use or how implement it in Stata? I hope my question is clear, if not, please just let me know.

Best,

Diego.