Announcement

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

  • Dropping individual cases

    I've looked in the manuals and can't find any information on how to drop individual cases. There is a small number of non-consecutive, non-missing cases that I need to drop. For example, I need to drop observation number 689, 759, 2131. I could just go in the data editor and delete the handful of cases individually, but I need to know how the command for this because I have to send my do-file to a colleague. Any suggestions?

    Thanks in advance.

  • #2
    drop in ... is documented. You could go

    Code:
     
    drop if inlist(_n, 689, 759, 2131)
    But it is much better style to spell out a reason for dropping using if. Otherwise do files are difficult to understand.

    Note that e.g.

    Code:
     
    drop in 689
    means that observations numbers are shifted so that 690 on are now 689 on, and so forth.

    Comment


    • #3
      Okay, thanks for the help. I guess I was looking for the wrong thing. I'll give this a shot.

      Comment


      • #4
        The clear ideal here is, in a standard phrase, reproducible research and, in a not so standard phrase, clear and rational reproducible research, so that the various steps are not only documented, but comprehensibly so. If you don't know how to code up a reason for dropping individual observations, you could always include in the do-file

        Code:
          
        list if inlist(_n, 689, 759, 2131)
        * these observations should be dropped because ...
        Here the asterisk introduces a comment.

        Comment

        Working...
        X