[learn, Stata, resources, installation, style, code, guidelines, best practices]

Overview: Why Stata?

overview of perks R offers

Stata is a statistical software package that is often used for data manipulation, visualization, and automated reporting. In this tutorial, we guide you to learn coding in Stata and its applications.

Objectives of this tutorial

  • Set up Stata
  • Learn to code in Stata following proper coding style guidelines
  • Learn how to run your first analysis

Set up Stata and Learn Style Guidelines

Stata can be installed on both Mac and Windows. It requires a Stata license to use the software. If you have a license and want to install and set up Stata, we have the building block Learn How to Set up Stata, where we guide you through the necessary steps.

Learn Style Guidelines in Stata

As with every programming language, to keep your code understandable for yourself and others, it is useful to follow some basic coding guidelines. In Stata you have two coding styles. You have a linear format for very short or simple scripts, and a functional style for longer or more complex scripts. For examples, see our building Stata Coding Style Guidelines.

You can check for errors in your Stata code by running an R script which checks for errors and completion of do-files. More details on this and the script can be found in the building block Integrating Stata in Automated Workflows.

Data Analysis with Stata

You can do multiple analyses and visualizations. One of the most widely used statistical methods is regression analysis. Our building block Run a Regression Analysis provides an overview of how to run a regression in Stata. It also provides information about exporting the regression results.

In addition, our building block Impact evaluation with Difference-in-Differences and Regression Discontinuity guides you through the Impact Evaluation techniques and provides information on how to use Stata to apply these techniques.