An Introduction to Stata Programming, Second Edition
Click to enlarge
See the back cover
$64.00 PrintAdd to cart
What are VitalSource eBooks?
Your access code will be emailed upon purchase.
$52.00 VitalSource eBookAdd to cart
$49.50 Amazon KindleBuy from Amazon
As an Amazon Associate, StataCorp earns a small referral credit from qualifying purchases made from affiliate links on our site.
Comment from the Stata technical group
Christopher F. Baum's An Introduction to Stata Programming, Second Edition, is a great reference for anyone who wants to learn Stata programming.
Baum assumes readers have some familiarity with Stata, but readers who are new to programming will find the book accessible. He begins by introducing programming concepts and basic tools. More advanced programming tools such as structures and pointers and likelihood-function evaluators using Mata are gradually introduced throughout the book alongside examples.
This new edition reflects some of the most important statistical tools added since Stata 10. 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.
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 command to calculate percentiles and the range of a variable, complete with documentation and certification.
After introducing the fundamentals of command development, Baum shows users how these concepts can be applied to help them write their own custom estimation commands by using 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. Baum briefly discusses how ado-file programming concepts relate to Mata functions and objects. He also explains some of the advantages of using Mata for certain programming tasks. Baum introduces concepts by providing the background and importance of 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 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.
About the author
Christopher F. Baum is a Professor of Economics and Social Work at Boston College, where he codirects the undergraduate minor in scientific computation. Baum has taught econometrics for many years, using Stata extensively. He has over 40 years of experience with computer programming in a variety of languages and has authored or coauthored several widely used Stata commands over the past 12 years. He is the author of An Introduction to Modern Econometrics Using Stata, an associate editor of the Stata Journal, and a participant in many Stata Users Group meetings in the United States and Europe.
Table of contents
View table of contents >>