Announcement

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

  • Droping observations with x amount of missing values

    Dear all,
    I'm working with a messy data set with approximately 870 observations at the moment.
    After using the command missings table, I realised that 91 observations have 99 missing values out of 108 variables. I used missings list, min(99) to see which observations
    account for this.
    Now, I want to drop these observations from the data set. I wonder if there is a command that would use the information produced by missings list, min(99) to drop these observations?
    Can anyone help? I've been looking for a solution for quite some time, without success.

    Thank you.

  • #2
    There is no -missings list- command in official Stata. Presumably this is some user-written command you have found somewhere. Without knowing where it comes from, it isn't possible to say much about it.

    Nevertheless, if your plan is to drop observations that have 99 missing values, you can do that this way:

    Code:
    egen mcount = rowmiss(_all)
    drop if mcount == 99

    Comment


    • #3
      Thank you Clyde, I should have mentioned that the -missings- command is a user written one available from SSC.

      Also, thank you for your suggestion, which does the job!

      Comment


      • #4
        Not quite. missings is (please) to be cited as published in the Stata Journal.


        dm0085_1 from http://www.stata-journal.com/software/sj17-3
        SJ17-3 dm0085_1. Update: A set of utilities for managing missing values /
        Update: A set of utilities for managing missing / values / by Nicholas J.
        Cox, Department of Geography, / Durham University, Durham City, UK /
        Support: [email protected] / After installation, type help missings

        dm0085 from http://www.stata-journal.com/software/sj15-4
        SJ15-4 dm0085. A set of utilities for... / A set of utilities for managing
        missing values / by Nicholas J. Cox, Department of Geography, / Durham
        University, Durham City, UK / Support: [email protected] / After
        installation, type help missings


        The help is forthright:

        there is no explicit support here for dropping observations or variables with some missing and
        some nonmissing values. Users so minded will find other subcommands of use as an intermediate step, but
        multiple imputation might be a better way forward.

        So, users must make up their own minds about throwing away data, and Clyde Schechter showed you how to do your dirty deed.
        Last edited by Nick Cox; 31 May 2019, 04:39.

        Comment

        Working...
        X