Hello StataList community, it's my first post, so thanks to all those that are answering me and helping me with my master's thesis.
I am working with panel data for EU28 NUTS2 regions, calculating the capital and knowledge stock according to perpetual inventory method.
Unfortunately there are recurrent missing data, that I am correctly taking into account when using the solution I propose. In particular, the last code doesn't work, but I'll put all the process to arrive to that, just in case you have a quicker way to do so.
I am working with panel data for EU28 NUTS2 regions, calculating the capital and knowledge stock according to perpetual inventory method.
Unfortunately there are recurrent missing data, that I am correctly taking into account when using the solution I propose. In particular, the last code doesn't work, but I'll put all the process to arrive to that, just in case you have a quicker way to do so.
Code:
clear input str5 tl2 int year float(capital_stock_ gr_gfcf_07_00_) long FCFormation " AT33" 1990 . . . " AT33" 1991 . . . " AT33" 1992 . . . " AT33" 1993 . . . " AT33" 1994 . . . " AT33" 1995 . . . " AT33" 1996 . . . " AT33" 1997 . . . " AT33" 1998 . . . " AT33" 1999 . . . " AT33" 2000 47952.36 .03020859 5045 " AT33" 2001 . . 4941 " AT33" 2002 . . 5000 " AT33" 2003 . . 5336 " AT33" 2004 . . 4970 " AT33" 2005 . . 5724 " AT33" 2006 . . 5893 " AT33" 2007 . . 6233 " AT33" 2008 . . 6454 " AT33" 2009 . . 5965 " AT33" 2010 . . 6027 " AT33" 2011 . . 6702 " AT33" 2012 . . 6871 " AT33" 2013 . . 7095 " AT33" 2014 . . 7268 " AT33" 2015 . . 7727 " AT33" 2016 . . . " AT33" 2017 . . . " BE1" 1990 . . . " BE1" 1991 . . . " BE1" 1992 . . . " BE1" 1993 . . . " BE1" 1994 . . . " BE1" 1995 . . . " BE1" 1996 . . . " BE1" 1997 . . . " BE1" 1998 . . . " BE1" 1999 . . . " BE1" 2000 . .08150125 . " BE1" 2001 . . . " BE1" 2002 . . . " BE1" 2003 . . 8492 " BE1" 2004 . . 10014 " BE1" 2005 . . 10534 " BE1" 2006 . . 11321 " BE1" 2007 . . 11765 " BE1" 2008 . . 12163 " BE1" 2009 . . 11434 " BE1" 2010 . . 11115 " BE1" 2011 . . 11388 " BE1" 2012 . . 11460 " BE1" 2013 . . 11938 " BE1" 2014 . . 12594 " BE1" 2015 . . 13475 " BE1" 2016 . . . " BE1" 2017 . . . end
Code:
bysort tl2_n (year): replace gr_gfcf_07_00_ = gr_gfcf_07_00_[_n-1] if missing(capital_stock[_n-1]) & year>=2001 & year<=2007 forvalues i=1(1)299 { forvalues j=2001(1)2007 { quietly replace capital_stock_ = (FCFormation/(gr_gfcf_07_00_ +0.075)) /// if year==`j' & tl2_count==`i' } }
Code:
clear input str5 tl2 int year float(capital_stock_ gr_gfcf_07_00_) long FCFormation " AT33" 1990 . . . " AT33" 1991 . . . " AT33" 1992 . . . " AT33" 1993 . . . " AT33" 1994 . . . " AT33" 1995 . . . " AT33" 1996 . . . " AT33" 1997 . . . " AT33" 1998 . . . " AT33" 1999 . . . " AT33" 2000 47952.36 .03020859 5045 " AT33" 2001 . . 4941 " AT33" 2002 . . 5000 " AT33" 2003 . . 5336 " AT33" 2004 . . 4970 " AT33" 2005 . . 5724 " AT33" 2006 . . 5893 " AT33" 2007 . . 6233 " AT33" 2008 . . 6454 " AT33" 2009 . . 5965 " AT33" 2010 . . 6027 " AT33" 2011 . . 6702 " AT33" 2012 . . 6871 " AT33" 2013 . . 7095 " AT33" 2014 . . 7268 " AT33" 2015 . . 7727 " AT33" 2016 . . . " AT33" 2017 . . . " BE1" 1990 . . . " BE1" 1991 . . . " BE1" 1992 . . . " BE1" 1993 . . . " BE1" 1994 . . . " BE1" 1995 . . . " BE1" 1996 . . . " BE1" 1997 . . . " BE1" 1998 . . . " BE1" 1999 . . . " BE1" 2000 . .08150125 . " BE1" 2001 . .08150125 . " BE1" 2002 . .08150125 . " BE1" 2003 54261.55 .08150125 8492 " BE1" 2004 63986.71 .08150125 10014 " BE1" 2005 67309.37 .08150125 10534 " BE1" 2006 72338.086 .08150125 11321 " BE1" 2007 75175.12 .08150125 11765 " BE1" 2008 . . 12163 " BE1" 2009 . . 11434 " BE1" 2010 . . 11115 " BE1" 2011 . . 11388 " BE1" 2012 . . 11460 " BE1" 2013 . . 11938 " BE1" 2014 . . 12594 " BE1" 2015 . . 13475 " BE1" 2016 . . . " BE1" 2017 . . .
Code:
forvalues i =1(1)299 { forvalues j=2001(1)2017 { if capital_stock_[_n-1]!=. /// quietly replace capital_stock_=((capital_stock_)*(.925)+(FCFormation)) /// if year==`j' & tl2_count==`i' } }