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 
 
Nick Cox <[email protected]> 
To 
 
"[email protected]" <[email protected]> 
Subject 
 
Re: st: Invalid Syntax 
Date 
 
Mon, 11 Nov 2013 16:34:23 +0000 
SJ-8-4  dm89_1  . . . . Dropping variables or observations with missing values
        (help dropmiss if installed)  . . . . . . . . . . . . . . .  N. J. Cox
        Q4/08   SJ 8(4):594
        update in style and content; added a new force option
STB-60  dm89  . . . . . Dropping variables or observations with missing values
        (help dropmiss if installed)  . . . . . . . . . . . . . . .  N. J. Cox
        3/01    pp.7--8; STB Reprints Vol 10, pp.44--46
        drops variables or observations with all values (optionally
        any values) missing
Nick
[email protected]
On 11 November 2013 15:58, Amir Sadeghi Emamgholi
<[email protected]> wrote:
> Thanks Richard and Fernando.
>
> I read the help on - drop - but did not notice that - drop varlist -
> doesn't accept - if - .
> Putting - drop - in an - if - works. Good way to work with commands
> that don't accept - if - Fernando!
> Thanks to both of you, again. - Amirsa
>
> On Mon, Nov 11, 2013 at 10:45 AM, Fernando Rios Avila
> <[email protected]> wrote:
>> 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/
> *
> *   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/