I have 5000
variables and 91,534
observations in my dataset.
I want to drop all variables that have all their values missing:
X1 X2 X3
1 2 .
. 3 .
3 . .
. 5 .
X1 X2
1 2
. 3
3 .
. 5
I tried using the dropmiss
community-contributed command, but it does not seem to be working for me even after reading the help file. For example:
dropmiss
command dropmiss is unrecognized
r(199);
missings dropvars
force option required with changed dataset
Instead, as suggested in one of the solutions, I tried the following:
ssc install nmissing
nmissing, min(91534)
drop `r(varlist)'
This alternative community-contributed command seems to work for me.
However, I wanted to know if there is a more elegant solution, or a way to use dropmiss
.