Hi there,

As I am estimating a disaggregated gravity model, it inherently contains many missing values simply because countries do not trade the same product category every year. As an example I have appended an excerpt of my data beneath. I would like to fill MOST of these missing values, as they are known in other observations if that makes sense. For example: I have variables for GDP which is known for each year and is allready filled out in observations with other HS6 codes. In essence, what I would like to do is fill this variables in the newly created (tsfill, full) observations.

----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
 year origin destination hs6digit export  import
2011 ""    ""         .        .         .
2012 ""    ""         .        .         .
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 "rus" "abw" 210500        0  10672.34
2016 ""    ""         .        .         .
2017 ""    ""         .        .         .
2011 ""    ""         .        .         .
2012 ""    ""         .        .         .
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 "rus" "abw" 240220    74130         0
2017 ""    ""         .        .         .
2011 ""    ""         .        .         .
2012 ""    ""         .        .         .
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 ""    ""         .        .         .
2017 "rus" "abw" 270900  3530132         0
2011 ""    ""         .        .         .
2012 ""    ""         .        .         .
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 "rus" "abw" 271000 21536285         0
2017 ""    ""         .        .         .
2011 ""    ""         .        .         .
2012 ""    ""         .        .         .
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 ""    ""         .        .         .
2017 "rus" "abw" 292212     5308         0
2011 ""    ""         .        .         .
2012 "rus" "abw" 847330        0      9988
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 ""    ""         .        .         .
2017 ""    ""         .        .         .
2011 ""    ""         .        .         .
2012 "rus" "abw" 851762        0      8949
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 ""    ""         .        .         .
2017 ""    ""         .        .         .
2011 ""    ""         .        .         .
2012 "rus" "afg"  40210    15432         0
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 ""    ""         .        .         .
2017 ""    ""         .        .         .
2011 ""    ""         .        .         .
2012 ""    ""         .        .         .
2013 "rus" "afg"  40299     3555         0
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 ""    ""         .        .         .
2017 ""    ""         .        .         .
2011 ""    ""         .        .         .
2012 "rus" "afg"  40390    20644         0
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 ""    ""         .        .         .
2017 ""    ""         .        .         .
2011 ""    ""         .        .         .
2012 ""    ""         .        .         .
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 "rus" "afg"  40900    40110         0
2016 ""    ""         .        .         .
2017 ""    ""         .        .         .
2011 "rus" "afg"  50400    51260         0
2012 ""    ""         .        .         .
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 ""    ""         .        .         .
2017 ""    ""         .        .         .
2011 "rus" "afg"  70190        0   9803998
2012 ""    ""         .        .         .
2013 "rus" "afg"  70190        0 1840135.6
2014 "rus" "afg"  70190        0  61082.65
2015 ""    ""         .        .         .
2016 ""    ""         .        .         .
2017 ""    ""         .        .         .
2011 "rus" "afg"  70310        0  65259.25
2012 ""    ""         .        .         .
2013 ""    ""         .        .         .
2014 ""    ""         .        .         .
2015 ""    ""         .        .         .
2016 ""    ""         .        .         .
2017 "rus" "afg"  70310    13475         0
2011 "rus" "afg"  70690        0  32443.64
2012 ""    ""         .        .         .
end
------------------ copy up to and including the previous line ------------------

Listed 100 out of 1648360 observations


I hope someone is able to assist me with this issue.

Kind regards,

Tim