Dear Statalisters,
I encountered an odd behavior of -capture drop-, and would appreciate
advice.
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
Max
-------------+--------------------------------------------------------
resid | 100 1 0 1
1
.
. capture drop r
.
. sum resid
no variables defined
r(111);
-------- 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.
Eddy
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
*
* 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/