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: Invalid Syntax


From   Fernando Rios Avila <[email protected]>
To   [email protected]
Subject   Re: st: Invalid Syntax
Date   Mon, 11 Nov 2013 10:45:19 -0500

If the intention of the loop is to drop "empty" vars, i would use the
following command
foreach i in E_I3 E_I4 E_I5 E_I6 E_I7 E_I8 E_I9 E_I10 E_I11 {
      qui summ `i'
      if r(N) == 0 {
     drop `i'
     }
}

HTH
Fernando

On Mon, Nov 11, 2013 at 10:36 AM, Amir Sadeghi Emamgholi
<[email protected]> wrote:
> Hello Statalisters,
>
> Sorry for this stupid question. I cannot figure out the problem with
> my drop command in the following loop. When I run it I get the -
> Invalid Syntax - error message.
>
> The loop:
>
> foreach i in E_I3 E_I4 E_I5 E_I6 E_I7 E_I8 E_I9 E_I10 E_I11 {
>       qui summ `i'
>       drop `i' if r(N) == 0
> }
>
> Thanks!
> Amirsa
>
> P.S. when I use - drop "`i'" if r(N) == 0 - I get the - "E_I3 invalid
> name - error message.
> *
> *   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