[email protected]
>
> I have a list of variables with a certain number of them
> labelled "...some label..., NA" (mostly DHS variables)
> where NA stands for Not Available.
>
> Since it is too hard to manually remove them, I would like
> to know if there exists a certain way to quickly drop them.
>
I am not clear on the details here:
in particular, I don't know what "DHS" means
and whether you mean _values_
when you say _labels_. But I think the
general problem is fairly clear.
There are various ways to approach it.
One which may apply is to decide that any
variable for which all values are identical is, in
essence, uninformative and can thus be
dropped.
Here is code for this. (Warning:
could be slow with very large data sets.)
foreach v of var * {
sort `v'
if `v'[1] == `v'[_N] {
drop `v'
}
}
-dropmiss- (STB-60) is another solution,
but it depends on your following
Stata conventions on missing values.
Nick
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/