I am working with panel data stata 16. I have panel of 120 countries and time 1990 to 2020. I want to take mean of 5 years only those countries that have every 5 year values. as in picture 2000 to 2004=2000 and 2005 to 2009= 2005. as you can see in pcture if a single year have missing value the county will drop. I have used
collapse GDPpercapitaconstant2015US , by(id year)
it took mean even one or two year data of these five years. for exampl if 2002 , 2003and 2004 have data and other two years have missing it take mean of three years. while i want to take only five years value otherwise drop that country.
please help me how i can
collapse GDPpercapitaconstant2015US , by(id year)
it took mean even one or two year data of these five years. for exampl if 2002 , 2003and 2004 have data and other two years have missing it take mean of three years. while i want to take only five years value otherwise drop that country.
please help me how i can

Comment