Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: Dropping variables conditionally


From   Ian Watson <[email protected]>
To   [email protected]
Subject   Re: st: Re: Dropping variables conditionally
Date   Thu, 14 Apr 2005 13:44:58 +1000

Dear Friedrich,

Thanks very much. Exactly what I was looking for.

Ian


Thursday, April 14, 2005, 1:23:29 PM, you wrote:

FH> Ian,

FH> You can use -dropmiss-.

FH> . findit dropmiss

FH> Friedrich Huebler

FH> --- Ian Watson <[email protected]> wrote:
>>   My particular task is to eliminate all variables from the dataset
>>   which are empty, that is, have no observations. The following bit
>>   of code has done this, but surely there is a simpler way which I
>>   have overlooked?
>> 
>> local droplist "drop "
>> foreach v of varlist * {
>>     qui count if !mi(`v')
>>     if r(N) == 0 local droplist "`droplist' `v'" 
>> }
>> `droplist'
>> 
>> 
>> -- 
>> Kind regards, 
>> Ian
>> 
>> -------------------------------
>> Ian Watson
>> Senior Researcher
>> acirrt, University of Sydney
>> NSW, 2006, Australia
>> 
>> phone: 02 9351 5622
>> email:[email protected]
>> www.acirrt.com
>> -------------------------------


		
FH> __________________________________ 
FH> Do you Yahoo!? 
FH> Yahoo! Small Business - Try our new resources site!
FH> http://smallbusiness.yahoo.com/resources/ 
FH> *
FH> *   For searches and help try:
FH> *   http://www.stata.com/support/faqs/res/findit.html
FH> *   http://www.stata.com/support/statalist/faq
FH> *   http://www.ats.ucla.edu/stat/stata/




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



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