Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | adrien bouguen <abouguen@povertyactionlab.org> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: local within global |
Date | Fri, 25 Nov 2011 16:59:42 +0100 |
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 way? -- Adrien Bouguen Chef de Projet Poverty Action Lab J-PAL Europe Paris School of Economics tel: +33 (0)1 71 19 40 83 port: +33 (0)6 69 34 12 02 * * 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/