
Cox’s, though primarily focused on Stata programs (.ado files) rather than procedural “.do” files, goes to great great lengths to support the idea that above all else, programs must be clear. McCann focuses on themes specifically relevant to general programming, but some of these themes are also woven throughout “Suggestions on Stata programming style” (Cox, 2005), appearing in the Stata Journal.

As McCann (1997) says, it is important to strive to “structure and document your program the way you wish other programmers would” (that is my emphasis on the document).
#Set more off stata code
Our code should be well thought out, well organized, and well documented. In the wake of the LaCour Scandal, the importance of documenting our data, our processes, and our analyses so that others can evaluate what we have done can hardly be understated. If it takes you a while to figure it out, how long would it take someone else to figure it out?” Put it away for a few months, and it will most like take you a while to figure out what it does and how it does it. “A program that is perfectly clear today is clear only because you just wrote it. Lester McCann (1997), a senior lecturer at the University of Arizona, outlines the importance of programming style in Toward Developing Good Programming Style (written for C and for Pascal for those of us who are that old). As with any written document, it exists to be read, and the readability of Stata code by the code’s creator, a colleague, or a mere spectator, depends upon the style in which the code is written. The code itself stands as a documentation of the programmer’s mind – how the problem addressed by the code, the approach taken, and the end result. However, the second purpose of computer code is to provide a record of what instructions were given. As long as the syntax is correct, the program will run. Stata doesn’t care much about style, its only concern is syntax. We are explaining to Stata, step by step, what we wish it to do.
#Set more off stata series
The first purpose, which Wilde may have seen as “sincerity” is to communicate a series of commands to the computer. Stata code, like computer code of any kind, has two purposes. Wilde, well known in his time for decadent style and flamboyant behavior, could have never imagined that his rather abruptly put witticism, extolling the virtue of style, can also aptly be applied to writing code in Stata. – Oscar Wilde, “ Phrases and Philosophies for the Young“ In all important matters, style, not sincerity is the essential.”


“In all unimportant matters, style, not sincerity is the essential.
