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: Using capture drop


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Using capture drop
Date   Mon, 27 May 2013 20:39:54 +0100

We can't see the example that is sparking this but usually there is no
mystery here.

The difference between

drop foo

and

capture drop foo

is that the first will fail if -foo- does not exist, stopping your
program or do-file. The second will just sail on by if -foo- does not
exist. In effect, you are saying

"I don't want -foo-; so if it doesn't exist, that's fine by me."

That is on a level with

"I don't want dirty dishes in my kitchen, so wash them up if there are any"

and you don't expect a message saying

"There are no dirty dishes in your kitchen. What now?"

Of course, you are living dangerously. If -foo- was valuable, you lost
it. it's as if you were saving a dessert for later but somebody threw
it out.
Nick
[email protected]


On 27 May 2013 20:21, Michael Stewart <[email protected]> wrote:
> Hi,
> I am trying to find the utility of command capture drop .
> I see that is being used in foreach loop etc but cannot understand  the logic.
> Can anyone please let me know if there is a good explanation along
> with examples anywhere in the web .
>
> --
> Thank you ,
> Yours Sincerely,
> Mike.
> *
> *   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/
*
*   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