Announcement

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

  • Drop rows that are empty in all variables

    Hi Statalist

    I have a question about trying to drop those rows that are empty in all the variables of my dataset.

    I understand this problem can be solved with:

    Code:
     
     drop if missing(var1) & missing(var2) & missing(var3)
    The problem I have close to a hundred variables, making this a very manual and laborious process. Is there any way to include a) all variables b) specified groups of variables at once?

    Thanks.

  • #2
    See -help egen-, and look at the -rowmiss()- function.

    Comment


    • #3
      Also, see missings (Stata Journal).


      SJ-17-3 dm0085_1 . . . . . . . . . . . . . . . . Software update for missings
      (help missings if installed) . . . . . . . . . . . . . . . N. J. Cox
      Q3/17 SJ 17(3):779
      identify() and sort options have been added

      SJ-15-4 dm0085 Speaking Stata: A set of utilities for managing missing values
      (help missings if installed) . . . . . . . . . . . . . . . N. J. Cox
      Q4/15 SJ 15(4):1174--1185
      provides command, missings, as a replacement for, and extension
      of, previous commands nmissing and dropmiss

      In Stata, type

      Code:
      search dm0085
      to get clickable links to the paper and the software (use the 2017 updated files).

      Comment


      • #4
        Thanks very much Mike and Nick for your suggestions. The missings commands are incredibly convenient for this purpose.

        Code:
        . missings dropobs, force

        Comment

        Working...
        X