Announcement

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

  • Dropping specific values of variable in a particular year

    Dear All
    I am new to this forum and will be greatful if you can help.
    I have a panel dataset over 8 year. I have a categorical variable (school) in the dataset which denotes 334 schools in a state ( from 1 to 334). I need to drop low-frequency schools in a particular year. for example, I want to drop school 1 in the year 2007 if it had less than 50 students. similarly, drop any school which had less than 50 admissions in 2008 and so on... so essentially I need to drop any school which had less than 50 admissions in a particular year during the study period.

    Thank you



  • #2
    Duplicate post. Asked and answered at https://www.statalist.org/forums/for...-in-panel-data.

    Comment


    • #3
      Welcome to Statalist.

      The answer to your question depends very much on what your data is like.

      You have panel data, Are the units of observation schools? or teachers within schools? or students within schools?

      How do you know what the number of admissions was each year?

      If school 1 has less than 50 students in 2007, do you want to drop its data for 2007, or for all 8 years?

      Please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question.

      Even the best descriptions of data are no substitute for an actual example of the data.

      Please be sure to use the dataex command to show example data. 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 and 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.

      The more you help others understand your problem, the more likely others are to be able to help you solve your problem.

      Comment

      Working...
      X