Please note this event occurred in the past.
October 16, 2025 1:00 pm - 3:00 pm ET
Data and Software,
Research Methodology,
Semester Workshops
Online - Zoom link sent upon registration
STATA Logo.

Instructor: Onupurba Das

Ever feel like you’re spending more time repeating lines of code just to get your data right instead of analyzing it? This workshop is here to change that! In this hands-on session, we’ll dive into loops and macros - two tools that’ll save you time and make your code more efficient.

Loops help you automate repetitive tasks - like running the same commands across a bunch of variables or datasets - while macros let you store values, file paths, or commands you can reuse across your project. You’ll get lots of practice during the session and leave with working examples you can build on in your own research.

 

Learning Objectives:

  1. Write and use loops (foreach, forvalues) to automate repetitive tasks in STATA, like running commands across multiple variables or datasets.
  2. Create local and global macros to store values, file paths, and commands that you can reuse throughout your code.
  3. Combine loops and macros to tackle more complicated tasks.
  4. Best practices for debugging and troubleshooting loops in STATA (time permitting).

Pre-requisites/Notes:

  1. This is not a beginner workshop—some comfort with STATA coding, do-files, and commands like merge, append, or regress will be helpful.
  2. We’ll use STATA for PC, but if you're on a Mac, we’ll highlight any differences as we go.
  3. Using your own laptop? Make sure STATA is installed and ready. STATA is also available on library computers, and you may be able to borrow a laptop with STATA installed from the library.