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

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


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Is this peculiar, or is it me?
Date   Thu, 4 Nov 2004 14:51:30 -0000

I can reproduce this. 

It looks like a bug, as if Stata is looking 
in (just) the wrong place. 

Nick 
n.j.cox@durham.ac.uk 

Philip Greenwood
 
> 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?
 

*
*   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