Hi, all.

I have dataset where country names (variable: Country) are missing rather randomly. I have to fill in the names for years 2000 until 2016, because I use these country names to then later recode to a numeric value. Here is an example of how the data looks like:
Code:
input float(ccode2 year) str57 Country
630 2000 ""           
630 2001 ""           
630 2002 ""           
630 2003 ""           
630 2004 ""           
630 2005 ""           
630 2006 ""           
630 2007 ""           
630 2008 ""           
630 2009 ""           
630 2010 ""           
630 2011 ""           
630 2012 ""           
630 2013 ""           
630 2014 ""           
630 2015 ""           
630 2016 "Iran"       
840 2000 "Philippines"
840 2001 "Philippines"
840 2002 "Philippines"
840 2003 "Philippines"
840 2004 "Philippines"
840 2005 "Philippines"
840 2006 "Philippines"
840 2007 "Philippines"
840 2008 "Philippines"
840 2009 "Philippines"
840 2010 "Philippines"
840 2011 "Philippines"
840 2012 "Philippines"
840 2013 "Philippines"
840 2014 "Philippines"
840 2015 "Philippines"
840 2016 "Philippines"
750 2000 "India"      
750 2001 "India"      
750 2002 "India"      
750 2003 "India"      
750 2004 ""           
750 2005 ""           
750 2006 ""           
750 2007 ""           
750 2008 ""           
750 2009 ""           
750 2010 ""           
750 2011 ""           
750 2012 ""           
750 2013 ""           
750 2014 "India"      
750 2015 "India"      
750 2016 "India"      
775 2000 "Myanmar"    
775 2001 "Myanmar"    
775 2002 "Myanmar"    
775 2003 "Myanmar"    
775 2004 "Myanmar"    
775 2005 "Myanmar"    
775 2006 "Myanmar"    
775 2007 "Myanmar"    
775 2008 "Myanmar"    
775 2009 "Myanmar"    
775 2010 "Myanmar"    
775 2011 "Myanmar"    
775 2012 ""           
775 2013 "Myanmar"    
775 2014 ""           
775 2015 ""           
775 2016 ""
And so on. I went to the FAQ (https://www.stata.com/support/faqs/d...issing-values/) but my question is how to I copy a string name for years that are missing between 2000 and 2016? I'm not sure if gsort will work here based on what I'm reading.

I played around with some code, such as
Code:
replace Country1 = Country1[_n+1] if inrange(year,2000,2016)
and so one, but no avail. (I made another variable, Country1, because Country is a string). (As a FYI, I used
Code:
encode Country, generate(Country1)
and it turned it into long). Thank you in advance for any help.