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: RE: capture drop issue
From
A Loumiotis <[email protected]>
To
[email protected]
Subject
Re: st: RE: capture drop issue
Date
Wed, 7 Jul 2010 11:03:44 +0300
Thanks a lot Martin!
On Wed, Jul 7, 2010 at 10:53 AM, Martin Weiss <[email protected]> wrote:
>
> <>
>
> *************
> clear
> set obs 10
> gen obs=_n
> gen obs2=2*obs
> gen var1=runiform()
> gen var2=rnormal()
> gen var3=var1*var2
> list
> drop obs2
>
> loc mydropvars obs2 var1-var3
> foreach var of local mydropvars{
> capture drop `var'
> di in r "return code for: `var': " _rc
> }
> list
> *************
>
>
> HTH
> Martin
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of A Loumiotis
> Sent: Mittwoch, 7. Juli 2010 09:43
> To: [email protected]
> Subject: st: capture drop issue
>
> Hi,
>
> I face the following problem with capture drop varlist.
> If one of the variables in the varlist does not exist, capture drop
> does not drop the rest of the variables in the varlist.
> I use Stata 11.
>
> Here is an example:
>
> ******
> clear
> set obs 10
> gen obs=_n
> gen obs2=2*obs
> gen var1=runiform()
> gen var2=rnormal()
> gen var3=var1*var2
> list
> drop obs2
> capture drop obs2 var1-var3
> list
> *****
>
> I would like my capture drop call to drop var1-var3 but because obs2
> is already dropped for some reason capture drop does not drop
> var1-var3.
> Is there an easy fix?
> Thanks,
> Antonis Loumiotis
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/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/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/statalist/faq
* http://www.ats.ucla.edu/stat/stata/