Liz's Stata Guide

New Favorite Trick

string with format
Can be used to add leading zeros when converting and combining ids stored as numeric variables to those stored as strings.

... more favorites

Latest Mistake

. gen x = 0.1

. count if x == 0.1
What is going on here?

... more mistakes


Welcome to my Stata guide! I first started putting this together when tutoring / teaching classes on statistics and econometrics for public policy while a grad student at the Woodrow Wilson School at Princeton. I'm continuing to update and expand it as my contribution to the internet.

I use Stata on an almost daily basis at work. Mostly what I do is pretty basic data manipulation and production of summary statistics. I don't use (and don't know) a lot of sophisticated statistical techniques, so the commands to implement them in Stata aren't included here. I do produce a fair number of graphics, and worry about how output is formatted, so this guide includes more on those topics than your average introduction to Stata.

If you find this page useful, please tell other people about it and link to it. Also, drop me a line at with comments, suggestions or questions.

... more about this guide

First Ten Stata Commands

Get started using Stata with 10 simple but very useful commands.
  1. use
  2. describe
  3. tab
  4. sum
  5. tab, sum
  6. ttest
  7. reg
  8. gen and replace
  9. histogram
  10. scatter

Next Ten Stata Commands

Once you've mastered the basics, these commands will change your life.
  1. recode
  2. bys
  3. tabstat
  4. table
  5. egen
  6. areg
  7. graph hbar
  8. reshape
  9. foreach
  10. outsheet

Stata Command Guide


Additional examples of basic statistical concepts and how to implement them in Stata:


Brief notes on other useful Stata topics:

.ado Files

New commands that I have implemented using .ado files
  • aareg: fixed effects with multiple absorbed variables
  • dlogit: maginal effects from logit model
  • dind: difference in differences estimator
  • svyttest: T-test with survey data
  • and more


Frequently asked questions

Not yet written

  • What's with the semi-colons?

last modified: 30 July 2014