An Introduction to Stata Programming, Second Edition

Click to enlarge
See the back cover

Inside preview

$58.00 Buy

Christopher F. Baum
Publisher: Stata Press
Copyright: 2016
ISBN-13: 978-1-59718-150-1
Pages: 412; paperback
Price: $58.00

Comment from the Stata technical group

Christopher F. Baum's An Introduction to Stata Programming, Second Edition, is a great reference for anyone that wants to learn Stata programming. For those learning, Baum assumes familiarity with Stata and gradually introduces more advanced programming tools. For the more advanced Stata programmer, the book introduces Stata's Mata programming language and optimization routines.

This new edition of the book reflects some of the most important statistical tools added since Stata 10, when the book was introduced. Of note are factor variables and operators, the computation of marginal effects, marginal means, and predictive margins using margins, the use of gmm to implement generalized method of moments estimation, and the use of suest for seemingly unrelated estimation.

As in the previous edition of the book, Baum steps the reader through the three levels of Stata programming. He starts with do-files. Do-files are powerful batch files that support loops and conditional statements and are ideal to automate your workflow as well as to guarantee reproducibility of your work. While giving examples of do-file programming, Baum introduces useful programming tips and advice.

He then delves into 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, its built-in nonlinear least-squares routines, nl and nlsur, and its built-in generalized method of moments estimation routine.

Finally, he introduces Mata, 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 discussing Mata, Baum presents useful topics for advanced programming such as structures and pointers and likelihood-function evaluators using Mata.

Baum introduces concepts by providing the background and importance for the topic, presents common uses and examples, and then concludes with larger, more applied examples he refers to as "cookbook recipes". Many of the examples in the book are of particular interest because they arose from frequently asked questions from Stata users.

If you want to understand basic Stata programming or want to write your own routines and commands using advanced Stata tools, Baum's book is a great reference.

Table of contents

View table of contents >>