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: local within global
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: local within global
Date
Fri, 25 Nov 2011 17:36:18 +0000
The backslash \ is probably messing up what you want as it is being
interpreted as an escape character. Use a forward slash, even under MS
Windows if you want \ meaning separator within filenames.
Nick
On 25 Nov 2011, at 15:59, adrien bouguen
<[email protected]> wrote:
Dear,
I still face a problem when I want to call a local within a global. I
have got a global which indicates my input directory and another
global which defines some dta names. Stata refuses to open the file
even when I add the curly brackets as advised in other conversations.
For instance:
I define two macros:
global input "directory"
global X "X1 X2 X3 X4"
then a loop such as:
foreach i in $score {
use "$input\`i'", clear
}
does not work. Writing "${input\`i'}" or "${input}\`i'" or even
"${input\{`i'}}" does not solve the problem.
I make it work with the cumbersome:
foreach i in $score {
local j="`i'"
use "$input\`j'", clear
}
Is there any other
*
* 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/