Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: RE: Dropping all missing values


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: RE: Dropping all missing values
Date   Mon, 14 Dec 2009 17:45:43 +0100

<> 


If you are certain you do not want to touch string missings, then Mosi
should at least make sure he gets the extended missings ([U], 12.2.1) as
well. A mere comparison with the "." missing value does not suffice. 



*************
sysuse auto, clear
replace foreign=.a in 4
foreach var of varlist rep78 foreign {
drop if `var'>=.
}
*************

The function -missing()- would encompass the string case as well, btw.


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Tharyan, Rajesh
Gesendet: Montag, 14. Dezember 2009 17:34
An: [email protected]
Betreff: st: RE: Dropping all missing values

Hi,

You can use the following code to do it.

 foreach var of varlist var1 var2 var3 {
 drop if `var'==.
 } 

Regards
rajesh
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mosi Ifatunji
Sent: 14 December 2009 16:30
To: Statalist
Subject: st: Dropping all missing values

Friends,

I am at the final stage of dataset preparation and would like to
remove all missing values. I know that I can drop all missing values
with the following syntax:

drop x1 if == .
drop x2 if == .

But, because I am going to have quite a few variables in the final
dataset, I would prefer as short a command syntax as possible. Of
course the goals of such an exercise is to ensure that all of my
analysis for this study is based on the same cases.

Thank you so much,

Mosi

-- 
Mosi A. Ifatunji, Ph.D. Candidate
ASA Pre-Doctoral Fellow
University of Illinois at Chicago
Department of Sociology (MC 312)
1007 West Harrison Street
Chicago, Illinois 60607-7140
Phone: (312) 607-2825
Email: [email protected]
Web: http://www.uic.edu/depts/soci/
http://blackyouthproject.uchicago.edu/
http://www.2008andbeyond.com/
http://www.ifatunji.com/

"Power concedes nothing without a demand."
                          - Frederick Douglass, 1857
*
*   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/

*
*   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/


*
*   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