Stata - Packages

Teaching Notes

Mingze Gao, PhD

Macquarie University


February 16, 2023


If you’ve ever used Python, you may know that it’s famous for its simplicity and the many packages available for use. Good news is, Stata is no different. We can install a wide range of Stata packages easily and then use them to achieve a ton of things.

This post briefly explains where to find, how to install and update Stata packages.

Stata packages

In a nutshell, installing and using Stata packages are as simple as the following two lines of code (and a line of output):

. ssc install nicewords
. nicewords
Absolutely excellent!

Specifically, we use the builtin command ssc to install a package named nicewords in the first line, and then execute the command nicewords in the second line, which randomly prints some nice words.

Generally, a package can provide one or more Stata commands to use, depending on the complexity of the task it solves.

Where to find Stata packages

ssc - Statistical Software Components Archive

Stata packages are hosted at the Statistical Software Components (SSC) Archive, which is often called the Boston College Archive and provided by This explains the example above where we used the command ssc to manage (install) packages.

We can find recently added packages with . ssc new, and the top 10 most popular packages on SSC with . ssc hot. In fact, the top 10 for December 2022 are:

Rank # hits Package Author(s)
1 63836.7 outreg2 Roy Wada
2 54131.9 estout Ben Jann
3 33531.3 winsor2 Yujun Lian
4 32575.0 asdoc Attaullah Shah
5 23632.8 grstyle Ben Jann
6 21866.9 reghdfe Sergio Correia
7 17123.1 ftools Sergio Correia
8 16163.0 logout Roy Wada
9 16161.3 fastgini Zurab Sajaia
10 13942.7 coefplot Ben Jann

net - e.g., GitHub

Apart from SSC, some packages are available on other websites like GitHub. A growing trend is that package authors publish their code repositories on GitHub, which contain the devlopment version of the packages.

How to install and update packages

ssc install is pretty much all we need. For example, to install the package reghdfe:

. ssc install reghdfe

For packages outside SSC, we can install them using net. As an example, I have a package specurve on GitHub, which can be installed by:

. net install specurve, from("")

To update an existing package, we can add the option replace to the above command:

. ssc install reghdfe, replace
. net install specurve, replace from("")

Alternatively, we can use ado update:

. ado update, update // for community-contributed packages
. ado update, update ssconly // for SSC only

Some packages of my choice

reghdfe and ivreghdfe

reghdfe is among the top 10 Stata packages as we’ve seen above. It allows for multiple fixed effects in linear regressions, while the builtin xtreg allows only one fixed effect. It’s gold!

ivreghdfe is essentially reghdfe plus ivreg2, which allows us to include multiple fixed effects in instrumental variable regressions.

estout and outreg2

estout is also a top 10 Stata package that provides tools to make regression tables. We’ve seen an example from the previous post. I highly recommend, too!

outreg2 does a similar job in a simpler way. Yet if we want finer controls estout is perhaps better, in my humble opinion.

winsor and winsor2

Data is often noisy with extreme values or impossible values recorded by mistake. In some fields of research, we try to mitigate such concern by winsorization. Note that they may yield different results due to their different approaches in determining percentile values.

Back to top