Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Tomas Lind <tomas.lind@sll.se> |
To | statalist@hsphsun2.harvard.edu |
Subject | Ang: Re: st: Words surrounded with single quotes in a local macro |
Date | Wed, 15 Jan 2014 14:08:21 +0100 |
After having created locals temp and temp2 I display them. The first local, temp, show the names I have excepted. di "`tempo'" tf1 tf2 tf3 tf4 tf5 tf6 tf7 tf8 However, Stata doesn´t return anything for temp2 di "`tempo2'" When Stata executes the append-statement, I get an error message: append using "`tempo2'" file not found /Tomas -----owner-statalist@hsphsun2.harvard.edu skrev: ----- Till: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> Från: Nick Cox Sänt av: owner-statalist@hsphsun2.harvard.edu Datum: 2014-01-15 13:52 Ärende: Re: st: Words surrounded with single quotes in a local macro You can help yourself debug this by showing us the value of `tempo2' and explaining what "Do[es] NOT Work" means precisely. Nick njcoxstata@gmail.com On 15 January 2014 12:30, Tomas Lind <tomas.lind@sll.se> wrote: > Hi all, > > I´m setting up number of tempfiles named tf1, tf2, tf3 . . . . > > First I create the names and put them into a macro called tempo. That works fine. > > The problem is with the second makro, temp2, where I try to store the names `tf1’ `tf2’ `tf3’ . . . enclosed in quotes to be able to use them in an append statement. > > I want the append statement to look like this: > append `tf1' `tf2' `tf3' . . . > > > forvalues i = 1/`Number' { // This many tempfiles > local tempo `tempo' tf`i' // named tf1, tf2, tf3 . . . okey > local tempo2 `tempo2' `"`tf`i''"' // `tf1’ `tf2’ `tf3’ . . . Do NOT work > } > > tempfile `tempo' // works fine > > > Loop that runs several regressions and store > each result in a tempfile > > > append using "`tempo2'" // Do NOT work > > > > > Anyone have a solution on this? > > I´m running Stata 13.1 on a PC > > Yours > Tomas > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/