Neil gave some excellent advice, but he broadened the question
as well. Richard Williams pointed to some style rules, but
they say nothing about content.
What criteria you apply to do files go in a loop with what
you expect from them. A starting point is that
the same do file with
the same data and
the same Stata
should yield
the same results.
This is testable by how far you can ensure
the same results e.g. (a) from yourself, a year later (b)
from some Statafriend using Stata on a different machine.
If that sounds obvious, the crunch is in the details.
What follows are just a few remainders. Some are
counsels of perfection and, depending on what I am
doing, I often ignore them. But then if things go wrong
I also know who to blame.
0. A do file should correspond to a log that it
creates and to any datasets it creates.
1. Be careful to get a report on the data that will
identify what version you are using. (-describe-)
2. Be careful to do the same with Stata. (-about-)
3. Be careful to flag all other do files called;
all user-written programs called; all self-written
programs called. In general, these will exist visible
to other installations of Stata only by accident.
4. Comments are useful. (* ... )
Nick
[email protected]
Neil Shephard
> Are there resources for systematic and efficient "best
> practices" in do-file colding, that beginning Stata users can
> emulate and integrate into their own work?
There are a number of ways of learning Stata...
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/