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

Re: st:delete all the obervations with negative values

From   Martin Weiss <>
Subject   Re: st:delete all the obervations with negative values
Date   Sat, 2 Aug 2008 22:59:54 +0200

I take it form your subject line and example that you want to delete obs whenever there is one NEGATIVE (and not missing) value, regardless of which var is concerned.


egen rmin=rowmin(var1 - var50)
drop if rmin<0


Quoting Man Jia <>:

Hi all,

Could anyone could give me some hint on how to delete all the
observations with missing values for at least one variable? I know it's
a quite simple question. But I havn't figured out a good way to deal
with this.

Here's an example to show this:
ID        var1       var2       var3

1           0           2           1
2          -2           1           3
3           0          -4           9
4           1           0           1
What I want to do is to drop observation whose ID is 2 and 3.

If there are not many variables in the data set, I know I could do:

. drop if var1<0| var2<0 | var3<0

But this way is inconvenient if there are a lot of variables (like 50
variables) in the data set.

Thanks for your kind help!

Have a nice weekend,

*   For searches and help try:

*   For searches and help try:

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