[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Drop variables satisfying a condition

From   n j cox <>
Subject   Re: st: Drop variables satisfying a condition
Date   Mon, 16 Jul 2007 19:58:46 +0100

There were several answers to this. I agree closely with Maarten Buis
and Austin Nichols, whose basic approach was to cycle over a varlist,
-count- observations satisfying the specified condition for each variable and then to -drop- the variable in question if all observations
satisfied the condition. My reasons for posting are just to

* add a literature reference in which this approach is applied to
_exactly_ the example problem (and others).

Cox, N.J. 2007. Making it count. Stata Journal 7(1): 117-130.

* mention -dropmiss- (-search dropmiss-), which could be used
for the example problem once zeros had been replaced by missing.


Guillermo Villa (edited)

I wonder whether it is possible to -drop- several variables in a dataset
specifying an -if- condition. For instance, it would be interesting
being able to -drop- all variables in the dataset for which all cases
are 0 or missing values. I have been reading the help documentation on
the -drop- command, however I am unable to find the right answer so
far. Note that I want to drop variables and not cases.

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index