Checkpoints

When a job will run for many hours, it is important to checkpoint the progress of the job, so that it can be restarted from the middle after an error or crash. Typically, a job consists of a data preparation phase, followed by a series of regressions. At a minimum The processed data should be saved before the regressions. The file can be written to /tmp quickly and without affecting your home directory quota. At NBER /tmp is not deleted after a system crash. If you have several checkpoints, each can write over the last:

save /tmp/userid.dta,replace

Skipping large sections of code can be done with the matched comment symbols "/*" and "*/", provided you aren't already using those for your actual comments. Another way to exclude code is with the -if- command:

if 0 { (excluded commands) } The "if 0" is false, so the group of commands in braces is skipped. -if- commands can be nested, which makes them better than comments. Stata has no goto command.

The -bootstrap- function has a special option for checkpointing.