This is the Stata cookbook for “Introduction to Data Science” in the M.Sc. Public Policy & Human Development.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Welcome to the Stata Cookbook for Introduction to Data Science


During the course “Introduction to Data Science”, we will build our very own Stata Cookbook. This repository will hold a collection of useful Stata commands with notes on when and how to use them.

We encourage you to use the joint Stata Cookbook for this course to build your own personal cookbook. Our shared collection of commands will cover most of the commands you will be using throughout the course, but there are good reasons to build on that foundation: perhaps you want to augment our notes on how to use commands, so that they are more clear or fit your preferred use better. Perhaps you found a useful commands or tricks online and you want to include them in your personal cookbook. Most importantly, once “Introduction to Data Science” ends, you will continue to use Stata in other courses. Having your own personal cookbook allows you to keep adding new commands and notes.

Get your copy

This repository always holds the most up-to-date version of our cookbook. There are two identical versions of the cookbook.

You can get the entire cookbook in one file (download), or you can get parts of the cookbook grouped by topic:

  1. (download)
  2. (download)
  3. (download)
  4. (download)
  5. (download)
  6. (download)

Additional components on manipuating variables, describing, estimating and testing are forthcoming and will be added both as individual do-files and to the all-in-one version.

Are you used to working with GitHub? You can also clone the entire repository to get your own versioned copy of the cookbook.


Our cookbook is meant to be a collaborative effort. If you found a useful command or trick elsewhere, or if you have useful additions to the notes, you can contribute them to the shared cookbook for the benefit of everyone!

There are two ways to contribute:

  1. If you are a GitHub user, use the regular GitHub workflow for contributing to projects: fork the repository, use a branch to add your contribution, then send us your changes with a pull request.
  2. If you are not a GitHub user, you can simply mail in your contribution.