Announcement

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

  • modification of dropmiss question

    Hello,

    The first row in my dataset is nonmissing for all variables (first row is labels). Besides the first row, however, many variables are completely missing. I understand the below code functions essentially as -dropmiss-, that is it will remove variables with missing data for all observations. Is there a way to modify it to exclude the first row?

    Code:
    foreach var of varlist _all {
        capture assert mi(`var')
        if !_rc {
            drop `var'    
         } 
         }
    Thanks!
    Reese

  • #2
    Code:
    foreach var of varlist _all { capture assert mi(`var') in 2/L if !_rc { drop `var' } }

    Comment


    • #3
      Perfect, thanks Clyde!

      Comment


      • #4
        You will probably not need the labels in the first row so a better way would probably be to get rid of the first row (or not import the row as variable labels/names(?) in the first place.

        Best
        Daniel

        Comment

        Working...
        X