dolog filename [ arguments ]
dolog (like do) causes Stata to execute the commands stored in filename.do as if they were entered from the keyboard, and echos the commands as it executes them, creating a text log file filename.log. If filename is specified without an extension, filename.do is assumed. If filename is specified with an extension, then the log file will have .log as an additional extension (so dolog will not overwrite the original do-file). Arguments are allowed (as with do or run), but the nostop option is not available.
The original version of dolog was apparently an example given as dofile in a Stata NetCourse. This version is slightly improved.
Note that a do-file should nearly always start with a version statement at or near the top. This is because, nearly always, we prefer the do-file to run in the Stata version in which it was written, even if the version of Stata has been upgraded. This practice also ensures that, if the do-file is run using dolog, then it is run under its own Stata version, and not under the Stata version of the current version of dolog.
An exception to this rule occurs when the do-file is a certification script. For these, it is better to use the dologx package instead of dolog. To find unofficial Stata packages which you might want to download, use net search or findit.
. dolog trash1
. dolog mycom argone argtwo
Roger Newson, National Heart and Lung Institute, Imperial College London, UK. Email: firstname.lastname@example.org
Manual: [R] do, [R] doedit, [R] log, [P] version
Help: [R] do, [R] run, [R] doedit, [R] log, [P] version, [P] cscript; dologx if installed