Statalist


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

st: re: do-file hygiene


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: do-file hygiene
Date   Sat, 27 Sep 2008 16:07:29 -0400

<>
Martin said

What I have learned, though, is that you must make sure you still understand
what you did half a year ago when that report comes back where the referee
says that you should really have included another year in your panel. A good
way to do that is to have your do-files instruct Stata to keep both
a-log-file, recording all screen output, and a command log. From my
experience, many users do not know about -cmdlog-s, and if they do, they
misunderstand the mechanism that allows simultaneous -log-ging
and -cmdlog-ging. The trick is that there is a handle (the -name- option)
which is distinct from the -filename-...



I fail to see what use a command log would be if created by running a do-file. The commands therein will presumably be exactly those of the do-file (unless you turn command logging off and on for some reason).

The philosophy expressed in various contexts by StataCorp personnel suggest creating a set of hierarchical do-files, similar to that used in producing a certification script (see Gould, http://ideas.repec.org/a/tsj/stataj/v1y2001i1p29-50.html which is freely downloadable). That is, your project (or dissertation, or whatever) master do-file calls do-files A1, A2, B1, B2, B3, C1, ... which may in turn call subsidiary do-files. When you execute the master file it runs all of the do-files associated with the project, each of which generates a standard log file. This approach both documents every step that you take, from the first access of the raw data to the final tables, charts, estimation output, etc. but the hierarchical arrangement means that you can document the order in which all of the do-files are run. If a new processing step is needed somewhere in the middle of the process that do-file can just be inserted in the sequence.

IMHO command logs are useful in interactive use of Stata, but as I would always rely on a do-file to do anything serious, I don't see why I would want to have both foobar.do and foobar.txt, with foobar.txt containing the commands in foobar.do.

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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