Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Is this peculiar, or is it me?


From   sdriver@stata.com (Shannon Driver, StataCorp)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Is this peculiar, or is it me?
Date   Thu, 04 Nov 2004 09:40:37 -0600

Philip Greenwood <philip.greenwood@mcri.edu.au> wrote:

> I entered some code into Stata and the output was not as I expected. I've
> pasted the log below. Note there is no dataset loaded into memory.
> 
> 
> . do "oddcode"
> 
> . foreach item in thing1 thing2 {
>   2.     di "item: `item'"
>   3.     local foo "a_great_big_fish"
>   4.     foreach var of varlist _all {
>   5.         di "variable: `var'"
>   6.     }
>   7. }
> item: thing1
> variable: a_great_big_fish
> item: thing2
> variable: a_great_big_fish
> 
> .
> end of do-file
> 
> While it's questionable at best to enter the -foreach var of varlist _all-
> with no data loaded, I would not have expected the macro `var' to evaluate to
> the contents of `foo'. Can anyone tell me what is going on here?

We have been able to reproduce this here, too.  We will have this fixed in the
next executable update.

--Shannon Driver
  sdriver@stata.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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index