Stata programming resources
Primarily meant for my graduate students, but the rest of the internet is also free to personally judge me if it wants.
Some basic thoughts on Stata
I do most of my statistical programming in Stata. The only exceptions are optimization and text analytic programs, for which I use Python, and a couple of econometric techniques for which the R packages are more convenient. Stata has so often made my life easier that I have an affection for it in a way that is normally reserved for one’s dog. And I have got a pretty great dog.
There are a few places in which Stata is deficient, but I usually find it simpler to code an entire project in Stata rather than using a separate language for things like data assembly. Stata’s data manipulation tools are often maligned, but they are actually quite good once you get used to the basic paradigm. I frankly find the complete data manipulation package in Stata more powerful and intuitive than SAS, with the sole exception being that calling SQL queries directly is more straightforward in SAS.
Pro tip: it is not worth it. If you want SQL, set up an ODBC connector. If you want more sophisticated merge tools for .dta files, write your own wrapper or use a prewritten one like mmerge. Running optimization routines is also more cumbersome in Stata, often requiring a drop into Mata, than in a more general purpose language like Matlab or Python. Mata is becoming progressively more powerful with each release, however, so it is worth looking into.
Where to learn it
The Kit Baum book, An Introduction to Stata Programming, is very good. The library has a copy, but it is also a reasonably priced textbook and it is worth having as a resource.
Princeton and UCLA both have excellent Stata resources:
The Princeton resources are better for explaining data manipulation and programming. The UCLA resources are better for understanding basic statistical operations. Wisconsin has a primer that is not bad:
StataCorp itself has a lot of good material. They offer online NetCourses on various topics. They are not cheap, but having gone through one I do think they are worth the money. It did an especially good job of covering the best practices that often get left out of more straightforward technical resources. Things like using assert statements to validate your data, which has saved me countless times since and which I would never otherwise have known what to do with.
The Stata manuals themselves are also often overlooked. They are free in PDF form. They are obviously useful as a reference, but the more general sections are written as an instruction tool as well. They are very well documented and provide both high level overviews of the techniques used, replete with formally written estimating equations, and excellent source documentation for further study.
Outputting tables from Stata
Particular attention should be given to creating tables from Stata output. There is only one answer here: use the estout command suite.
I cannot stress this enough. The estout package is fantastically powerful, and the esttab wrapper produces bulletproof, production quality tables for 95% of cases. All of my programs spit out very nice looking, fully formatted tables directly into my paper. I never have to touch them by hand. If I change something in my estimation program, I just rerun it and the table output is rewritten automatically. It is that powerful.
If you are copying text from the command window into your tables using copy-paste, you are doing it wrong. For your own sanity, stop it.
There is also outreg and its follow-up outreg2. Development on outreg has apparently restarted, and John Gallup is updating it again, but it still feels a bit too basic. outreg2 is more fully featured, but I would not use it, at least not for final production. While Roy Wada has done and continues to do a fantastic job of updating it, I still feel it sacrifices too much flexibility in the name of simplicity and compactness. That simplicity is useful when doing early exploratory work interactively, but the power and flexibility of the estout suite makes it my primary choice. This is especially true for people willing to dirty their hands with a little programming, since estout handles passthrough options so well. It is also exceedingly well documented.
As a final note, I am obviously an estout fanboy, so take my opinions for what they are. But then it is the internet, so you kind of knew that already.
See also
csestudy, my Stata command for cross-sectional event study estimation.- Scripts and ado files, including several small Stata utilities.