[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

[no subject]

From   Andreas Peichl <>
Date   Tue, 13 May 2008 18:48:49 +0200

Dear Statalisters,

(sorry for a possible double posting, but it seems to we that my first message
did not go through to the list)

I'm using Stata to call a program written in C++ to execute some simulations.
One run of this program takes about 15 min. I'm using several nested foreach
and forvalue loops to simulate different scenarios and to bootstrap the results
which I save in a matrix. The whole program runs for about a week. As this is a
quite time consuming exercise, I'm quite vulnerable to system crashes. I'm
therefore looking for a way to save the whole content of the Stata memory
(data, macros, matrix) to the hard disk which could then be restored if the
system crashes and I could restart at this point. (It would be something like
-preserve- and -restore- but not only for data).

Searching the Statalist archive, I came across this thread:

Using these programs to save the contents of the globals and locals together
with -save- and -svmat-, I was thinking of writing a "savetoHD" (and
readfromHD) command. I could then write my program in the following way (using
pseudo code):

readfromHD (x, start, end)    // read in parameters from previous run, x is last
                                 element used in loop
local start = `x'                     // set starting value of this loop to this
                                         last element
forval x = `start'/`end' {        // start loop
savetoHD                           // save parameters
simulation , ...
save results

(My problem is somewhat more complicated as I have nested loops but in principle
it should work this way).

Does anybody know a better way (or even a command) of how to achieve this
"preserve-restore" procedure? Any suggestions are warmly welcome.

Many thanks,

Dr. Andreas Peichl
Universität zu Köln
Seminar für Finanzwissenschaft, Lehrstuhl Prof. Dr. C. Fuest
Albertus-Magnus-Platz | 50923 Köln
Tel: +49(0)221-470-6201 | Fax: +49(0)221-470-5060
Mail: | URL:

*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index