An Introduction to Stata Programming

Click to enlarge
See the back cover

$54.00 Buy

Christopher F. Baum
Publisher: Stata Press
Copyright: 2009
ISBN-13: 978-1-59718-045-0
Pages: 362; paperback
Price: $54.00

Comment from the Stata technical group

Christopher F. Baum’s An Introduction to Stata Programming is worthwhile for anyone wanting to learn about programming in Stata. For the beginner, Baum assumes only that the user is familiar with Stata, so he builds up accordingly. For the more advanced Stata programmer, the book introduces Stata’s Mata programming language and provides optimization tips for day-to-day work. All readers will find better, new ways to approach old tasks.

Baum steps the reader through the three levels of Stata programming. First up are do-files. Though often thought of as simple batch files, do-files support both loops and conditional execution; hence, they can be used for automation as well as reproducibility. While giving examples of do-file programming, Baum introduces useful but often-overlooked Stata constructions.

Next come ado-files, which are used to extend Stata by creating new commands that share the syntax and behavior of official commands. Baum gives an example of how to write a simple additional command for Stata, complete with documentation and certification. After writing the simple command, users can then learn how to write their own custom estimation commands by using both Stata’s built-in numerical maximum-likelihood estimation routine, ml, and its built-in nonlinear least-squares routines, nl and nlsur.

Finishing up the book are two chapters on programming in Mata, which is Stata’s matrix programming language. Mata programs are integrated into ado-files to build a custom estimation routine that is optimized for speed and numerical stability. While stepping through these structures, Baum weaves in the details that are needed to become an expert at Stata programming, so readers will also learn more about Stata itself while learning the tools for programming.

Baum approaches each topic by first explaining the background and need for the topic, then looking at the basic usage and examples, and finally examining use within larger, more applied “cookbook” examples. Many of his examples come from questions posed on the Statalist listserver, so they address complexities of interest to a broad range of Stata users. The programming examples cover an array of topics, illustrate some of Stata’s built-in tools (such as the resampling techniques of bootstrapping and jackknifing), and offer solutions to tricky data management questions.

The breadth and depth of this book make it a necessity for anyone interested in programming in Stata.

Table of contents

View table of contents >>