Useful Commands

Below are some STATA commands that I wrote and found useful in data work. Hope you will find them useful, too. More detailed usage instructions are provided in each file.

Module Description
reclink4 (by request) Updates the reclink2 package by Wasi and Flaaen for exact and fuzzy merging of firm names and addresses. Substantially improves performance by minimizing loops.

Reports the list of most frequent values of a set of variables. For example, in a dataset of counties, it can print 20 largest states (by population), their population shares in the country, and the average income per capita in all counties of each state.


Adds more functionality to the binscatter command: variable labels, robust standard errors, automatic footnotes, etc.


Demeans a list of variables (optionally within cells), with replace or generating new variables.

recover.ado Fills in empty variables after running fillin or tsfill.

Reports the share of observations (or weights) which satisfy some condition, within a subsample defined by another condition.

Code for My Papers (provided by request)

Paper Description Language
Revisiting Event Study Designs Implements estimators, graphical, and statistical tests developed in the paper STATA
Consistency and Inference in Bartik Research Designs Implements the computationally efficient QMLE estimator and standard errors for QMLE and OLS R