Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Taking Mean of panel data

    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
    Attached Files
    Last edited by Shahla Akram; 21 Jul 2022, 10:58.

  • #2
    Duplicate post. If interested, see https://www.statalist.org/forums/for...-of-panel-data.

    Comment

    Working...
    X