Data Wrangling and Loops in Stata

This workshop is intended for people who feel comfortable with the material covered in our Introductory Statistics Using Stata workshop. We will use hands-on examples to cover:

  • Sub-setting by observations or by variables
  • Creating new variables as functions of existing variables
  • Aggregation/summarizing by observations or by variables
  • Reshaping (pivoting) from wide to tall or from tall to wide formats
  • Concatenating or merging data from several datasets
  • Using loops for repetitive tasks to make analyses more efficient

If you intend to follow along with the Stata coding during the workshop, please make sure that you have the latest version of Stata installed. The latest version of Stata can be purchased on their website, Alternatively, you can request a free research computing account through the Cornell Center for Social Sciences by visiting which will allow you to access Stata through a remote desktop.