Bookmark and Share

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]

st: -rolling, saving()- and -tempfile- error


From   Roberto Ferrer <[email protected]>
To   Stata Help <[email protected]>
Subject   st: -rolling, saving()- and -tempfile- error
Date   Mon, 3 Feb 2014 22:02:19 -0430

Running the following code does not work:

*------------- begin code ----------------

clear all
set more off

* Load data
sysuse sp500
tsset date

tempfile aux results

* Set fixed independent variable
local var open

foreach depvar of varlist high low close volume {

    rolling _b, window(30) saving("`aux'", replace): regress `depvar' `var'
    use "`aux'", clear
    rename (_b_`var' _b_cons) (b_`depvar'_`var' b_cons_`depvar'_`var')

    capture noisily merge 1:1 start end using "`results'"
    capture noisily drop _merge
    save "`results'", replace

    sysuse sp500, clear
    tsset date
}

* Check results
use "`results'"
browse


*------------------ end code ----------------------

The error is:

file /tmp/St05392.000001" saved
file /tmp/St05392.000001 not found
r(601);

When substituting this

rolling _b, window(30) saving("`aux'", replace): regress `depvar' `var'

for this

rolling _b, window(30) saving(`aux', replace): regress `depvar' `var'

it works fine. I thought the double quotes surrounding the -tempfile-
-aux- were harmless. What's going on here? According to the error
output, there's a " (double quote) getting saved in the file name.
With the substitution this doesn't happen:

file /tmp/St05392.000001 saved

I'm using Stata 12.1 for Unix, Revision 09 Jul 2013.
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index