Announcement

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

  • dropping variables with missing data

    Hi all,
    I have a set of data with 51 observations and 1160 variables. I would like to drop all variables with missing data > 10%.
    Will appreciate your help

    stata 15.1
    mac


  • #2
    Code:
    foreach var of varlist *{
        qui count if missing(`var')
        if (r(N)/`=_N')> 0.1{
            drop `var' 
        }
    }

    Comment

    Working...
    X