Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: dropvars.ado


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: dropvars.ado
Date   Tue, 15 Jan 2013 22:10:31 +0000

The text at REPEC says, modulo a typo,

"dropvars varlist is similar to drop varlist, but warns if a variable
does not exist, rather than aborts."

However, if any of the names is not that of an existing variable, it
is difficult to see how the program Austin gives can get past first
base, as -syntax- will throw it out before the -for- loop is entered.

Also, unless Dimitriy is using Stata 6, there is no reason not to use
-foreach-. (Historians of Stata will join in an unaffectionate
rememembrance of the old -for- command.)

This is offered up to criticism:

program anotherdropvars
     version 7
     foreach v of local 0 {
             capture drop `v'
             if _rc {
                  noi di as txt "`did you really mean `v'?"
             }
    }
end

Nick

On Tue, Jan 15, 2013 at 9:49 PM, Austin Nichols <[email protected]> wrote:
> Dimitriy V. Masterov <[email protected]>:
> The abstract at http://ideas.repec.org/c/boc/bocode/sjw4.html implies
> the command does:
>
> version 6:for var `varlist': capture drop X
>
> so try
>
> prog dropvars2
> syntax [varlist]
> version 6
> for var `varlist': capture drop X
> end
>
>
> On Tue, Jan 15, 2013 at 4:36 PM, Dimitriy V. Masterov
> <[email protected]> wrote:
>> Rich,
>>
>> Unfortunately, I think dropvars.do != dropvars.ado. Dropvars is an
>> piece-wise version -capture drop varlist-. The ado file linked from
>> http://ideas.repec.org/c/boc/bocode/sjw4.html no longer exists.
>>
>> DVM
>>
>> On Tue, Jan 15, 2013 at 1:20 PM, Richard Goldstein
>> <[email protected]> wrote:
>>> use the -findit- command (e.g., -findit dropvars-)
>>>
>>> Rich
>>>
>>> On 1/15/13 4:00 PM, Dimitriy V. Masterov wrote:
>>>> Does anyone know where one can find the code for Jeroen Weesie's dropvars?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index