I would like Stata to linearly interpolate missing values if the gap is relatively short (i.e. 3 years or less). I was thinking of using the ipolate command, but I am a bit lost how to tell Stata to recognize the short gaps.
For example, I have a panel data set that look similar to the following:
I want Stata to interpolate x for 1996-1998, but not for 2006-2011. Anyone could help me on how to proceed? This seems like a really basic question but I am still having trouble even after going over the help file of tsspell command as well as the following threads:
https://www.statalist.org/forums/for...-in-panel-data
https://www.stata.com/support/faqs/d...-observations/
Thanks so much!
For example, I have a panel data set that look similar to the following:
country | year | x |
36 | 1990 | 1.88E+09 |
36 | 1991 | 2.05E+09 |
36 | 1992 | 2.09E+09 |
36 | 1993 | 2.10E+09 |
36 | 1994 | 2.02E+09 |
36 | 1995 | 1.96E+09 |
36 | 1996 | |
36 | 1997 | |
36 | 1998 | |
36 | 1999 | 1.97E+09 |
36 | 2000 | 1.88E+09 |
36 | 2001 | 1.99E+09 |
36 | 2002 | 1.98E+09 |
36 | 2003 | 1.95E+09 |
36 | 2005 | 1.85E+09 |
36 | 2006 | |
36 | 2007 | |
36 | 2008 | |
36 | 2009 | |
36 | 2010 | |
36 | 2011 | |
36 | 2012 | 1.79E+09 |
36 | 2013 | 1.61E+09 |
40 | 1990 | … |
40 | 1991 | …. |
https://www.statalist.org/forums/for...-in-panel-data
https://www.stata.com/support/faqs/d...-observations/
Thanks so much!
Comment