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

st: problem with -capture drop-

From   Eddy <[email protected]>
To   [email protected]
Subject   st: problem with -capture drop-
Date   Tue, 21 Oct 2003 13:15:21 -0700 (PDT)

Dear Statalisters,

I encountered an odd behavior of -capture drop-, and would appreciate

I have a program in which a variable called "resid" was created
first, and another variable "r" was created later. Before creating
"r", I want to make sure that there is no existing variable sharing
the same name. So I issue

     capture drop r

to make sure there is no "r" before it is created. The problem is,
the above line also drops "resid" which I'd like to keep it there.
The symptom can be illustrated as the follows.

---------- example -------------------
. set obs 100
obs was 0, now 100

. gen resid = 1

. sum resid

    Variable |       Obs        Mean    Std. Dev.       Min       
       resid |       100           1           0          1         

. capture drop r

. sum resid
no variables defined

-------- end of example -------

This is true for both Stata 7, 7SE, and 8SE. My question: Is this the
intended behavior? Is there anyway to tell Stata to drop only those
literally specified? Thanks.


Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
*   For searches and help try:

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