»  Home »  Products »  Features »  User-written commands
Order Stata

User-written commands

What’s Hot on the SSC archive

The Stata community is represented by a diverse group of researchers from a broad spectrum of fields, from anthropology to biostatistics, economics, finance, political science, psychology, public health, sociology, survey research, and zoology. Stata’s programming language lets users write commands that behave just like official Stata commands, and many users make their commands available to others through channels such as the Stata Journal, the SSC archive, or their own website. Stata’s search, net search, and ssc commands make finding and installing those commands a snap. So even if you don’t see something listed on our Features page, another user may have already written and made available a command to solve your problem.

Stata’s user-written commands are supported by the people who wrote them. StataCorp does not certify the validity of these commands, nor do we offer technical support for them. However, many of the authors are also members of the Statalist forum, and user-written commands are a frequent topic of discussion.

The number of available user-written commands is ever-growing, so even if a command is not currently available for your task, one may appear in the future. If you have installed Stata, you can easily locate a user-written command by using the search command to conduct a search based on keywords you specify. For example, say that you want to produce a forest plot, a type of graph common to meta-analysis. In Stata, you can type

       . search forest plot

You will then be presented with a list of potentially suitable commands, and you can click on the blue links to read more about them and to install them. If you do not yet have Stata, you can search the SSC archive. The SSC archive contains many, though not all, user-written commands.

Below we highlight just some of the categories of user-written commands available.


In medical disciplines, such as oncology or cardiology, many studies of the same disease or treatment are performed. Meta-analysis is the use of statistical techniques to combine results from different studies, and many user-written commands have been produced in this area, including commands for tests for heterogeneity, cumulative pooled estimates, meta-analysis regression, tests for publication bias, funnel plots, forest plots, and L’Abbe plots.

Treatment effects

Did participants in a training program obtain wages higher than their peers who did not participate? Treatment-effects estimators are used to measure the impact of an event, controlling for confounding factors such as age, gender, or level of education. Stata offers 17 built-in commands for treatment-effects estimation. In addition, many user-written commands exist to estimate treatment effects.

Output generation

Ultimately, we need to communicate our results to others, and researchers typically do this by presenting tables of summary statistics and estimation results. Different disciplines and journals have their own styles, and an array of user-written commands for producing output exists to satisfy virtually all tastes. If Stata's official abilities to produce output in Word, PDF, Excel, HTML, and other formats don't fit your needs, a user-written command likely exists that does.

Limited dependent-variable models

Not all dependent variables are continuous. Some are binary. Some are ordered. Some represent counts. Some are censored. Some are subject to sample selection. While Stata includes a spectrum of commands to handle such variables, the number of existing models is overwhelming and continues to grow. Fortunately, Stata’s built-in capability for programming maximum likelihood estimators makes implementing new models straightforward for user-programmers. Scores of user-written commands for limited dependent-variable models are now available for cross-sectional, panel, and multilevel datasets.

Survival analysis

The focus of survival analysis is to model the amount of time required for an event to occur. Stata’s built-in survival analysis commands are widely recognized to be among the best in the industry, and practitioners have written additional commands to round out Stata’s offerings. Many user-written commands are available for cure and relative-risk models, discrete-time proportional-hazards models, and flexible parametric models.

Data management

When starting a research project, the data are almost never in the form you would like. Stata’s built-in data-management facilities are renowned, but you may come across a dataset that requires a custom level of manipulation beyond what you think Stata can do. Another Stata user has probably faced the same problem already and has made available a command to do the “heavy lifting”. Whether you need to convert data from a GIS program, manipulate value labels in your dataset, apply a linear filter, or create a complicated indicator variable, a user-written command is probably available to help.

Multilevel and correlated data

Pupils are clustered within classrooms, which are clustered within schools, which are clustered within school districts. Consumers are clustered within neighborhoods, which are nested within towns, which are nested within metropolitan areas. Many datasets have observations that are nested within one or more larger groupings. Ignoring the correlations inherent in such data can result in inefficient or biased results. Stata offers 15 built-in commands for multilevel mixed-effects models. In addition, many user-written commands exist for multilevel data.


Econometricians frequently develop new estimators and tests, which are then implemented by Stata users. A variety of user-written commands are available for inequality measurement, interrupted time-series analysis models, demand-system estimation, and wage decompositions, to mention just a few areas of development.

Statistical graphs

Stata’s flexible graphics engine has motivated users to develop a variety of statistical graphs. Whether you need a specialized regression diagnostic plot to analyze the fit of your model, a plot of the cumulative distribution of a variable, a cycle plot to examine seasonality, a spine plot of two-way categorical data, a Bland–Altman plot to compare two assays, or a choropleth to map the spatial distribution of poverty, another Stata user has probably written the command you need.


Spatial data visualization. Marginal effects. Univariate and multivariate statistical tests. The range of user-written commands available is as diverse as the people who use Stata. Regardless of your field of study, there are user-written commands that will complement your Stata experience.

Stata’s user-written commands are supported by the people who wrote them. StataCorp does not certify the validity of these commands, nor do we offer technical support for them. StataCorp does not offer a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose or any command’s statistical or other accuracy.

The power of Stata is extended by a dedicated and very sophisticated user community who have written thousands of programs. These user-written commands are easily found using Stata's built-in search engine, which helps you find and easily install such programs. Once installed, these programs work just like regular Stata commands and have help files that are accessed in the same way you access help for regular Stata commands.

— Michael Mitchell
Senior statistician at the USC Children's Data Network, author of four Stata Press books,
and former UCLA statistical consultant who envisioned and designed the
UCLA Statistical Consulting Resources website





The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn Google+ YouTube
© Copyright 1996–2017 StataCorp LLC   •   Terms of use   •   Privacy   •   Contact us