Statalist


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

st:delete all the obervations with negative values


From   Man Jia <[email protected]>
To   [email protected]
Subject   st:delete all the obervations with negative values
Date   Sat, 2 Aug 2008 16:43:07 -0400 (EDT)

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,

Mandy
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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