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: strange error with stata10 and 9 using by


From   [email protected]
To   [email protected]
Subject   Re: st: strange error with stata10 and 9 using by
Date   Tue, 24 May 2011 00:26:20 +0200

thanks Nick I have fixed it

2011/5/23 Nick Cox <[email protected]>:
> In some lines here you refer to -fechalta- and in some to -fechaalta-.
> But my guess is that you would see different messages if that was the
> problem.
>
> This works as expected:
>
> . sysuse auto, clear
> (1978 Automobile Data)
>
> . sort foreign
>
> . set seed 2803
>
> . gen y1 = runiform()
>
> . gen y2 = runiform()
>
> . by foreign : gen flag = 1 if y1 > y2
> (40 missing values generated)
>
> . drop if flag
> (74 observations deleted)
>
> .
> . sysuse auto, clear
> (1978 Automobile Data)
>
> . sort foreign
>
> . set seed 2803
>
> . gen y1 = ceil(10 * runiform())
>
> . gen y2 = ceil(10 * runiform())
>
> . by foreign : gen flag = 1 if y1 == y2
> (70 missing values generated)
>
> . drop if flag == 1
> (4 observations deleted)
>
> On Mon, May 23, 2011 at 3:24 AM,  <[email protected]> wrote:
>
>> I have a very strange error when I run the do file with stata 10 and 9
>>  for example see the code below . The first variable is generate the
>> second one not, if I eliminate" by codind"
>> still to work. I don't understand what happen.
>> thanks in advance
>> best
>> Nico
>>
>>  sort codind fechalta fechabaja
>> by codind : gen coin=1 if fechalta>fechabaja
>> drop if coin==1
>> (64329 observations deleted)
>> by codind : gen coin1=1 if fechalta==fechabaja
>> drop if coin1==1
>> coin1 not found
>> r(111);
>>
>> gen coin1=1 if fechaalta== fechabaja
>> drop if coin1==1
>> (300 observations deleted)
>> drop coin1
>
> *
> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index