Announcement

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

  • Panel data deleting missing observations

    For each country and each indicator, I want to compute the simple average across time period. But before I do this I have to clean data. This process involves deleting the countries with data missing for all years. There will be some countries with missing data for some of the years; I want to keep them as long as they have more than 5 data points because that way I can still calculate the average.

    I have attached the screenshot of my dataset. I would really appreciate if someone could help me here with the code for panel data.
    Attached Files

  • #2
    Please read the Forum FAQ. They specifically point out that screenshots of data are not helpful. This one is not readable on my computer. Even if it were, you cannot import data from a screenshot to work with in Stata. The helpful way to show example data is to use the -dataex- command. If you are running version 15.1 or a fully updated version 14.2, it is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    When asking for help with code, always show example data. When showing example data, always use -dataex-.

    That said, the overall visual pattern of your data suggests that the extend of missing data varies from one variable to the next, so it isn't clear what you want in any case.

    Comment

    Working...
    X