This repository contains the materials for D-Lab Stata Fundamentals workshop. Please refer to the Stata Fundamentals Google Slides for the accompanying material to this workshop.
This workshop is a three-part introductory series that will teach you Stata from scratch with clear introductions, concise examples, and support documents. You will learn how to download and install the Stata software, understand data and basic manipulations, import and subset data, explore and visualize data, and understand the basics of automation in the form of loops and functions. After completion of this workshop you will have a foundational understanding to create, organize, and utilize workflows for your personal research.
Each of the parts is divided into a lecture-style coding walkthrough interrupted by challenge problems, discussions of the solutions, and breaks. Instructors and TAs are dedicated to engaging you in the classroom and answering questions in plain language.
Part 1: Introduction
- Loading datasets into Stata (no previous knowledge expected)
- Examining a dataset and finding variables of interest
- Summarizing and tabulating variables
- Stata specific tools and resources (do files, logs, help files, etc.)
- Coding and cleaning data (making new variables from old variables; labeling variables and values, etc.)
- Using logical operators in Stata
- Cross-tabulations
Part 2: Data Analysis in Stata
- Correlation
- T-tests
- Ordinary Least Squares (OLS) and logistic regression (basic syntax, using interaction terms, interpreting output)
- Visualization (histograms, bar graphs, scatter plots)
- Regression postestimation (getting predicted values, basic graphs)
- Merging and appending datasets
Part 3: Stata Programming
- Local and global variables (macros)
- Looping (foreach, forvalues)
- Reshaping data between wide and long formats
- Recalling and using command output
- Generating nicely formatted journal-style tables
In preparation for the upcoming workshop, you will need to install Stata and download the workshop materials.
-
Download & Install Stata: To download the installation materials, please visit the Stata website. The credentials you need to enter will be emailed to you prior to the start of the workshop. For assistance with installation, you may view the Stata installation guide.
-
Install the Stata License: The Stata license will be provided to you in your calendar invitation once your register for the workshop. If you currently have Stata installed, you do not need to reinstall Stata. However, if you would like to use the trial license we are providing for Stata17MP, feel free to install it. Please do not share this license and note that the license is a trial and will expire later next month.
-
Download the Workshop Materials: The workshop materials can be obtained from this GitHub repository.
- Click the green "Code" button in the top right of the repository information.
- Click "Download Zip".
- Extract this file to a folder on your computer where you can easily access it (we recommend Desktop).
We will take a few minutes at the start of the workshop to make sure everyone has Stata installed and the workshop materials downloaded. Please feel free to email or visit the D-Lab Front Desk if you have any questions.
If you have a Berkeley CalNet ID, attend the workshop anyway, where we can provide you with a cloud-based solution by using the UC Berkeley Library Citrix Service for campus' shared Stata licenses.
Check out the following resources to learn more about Stata:
- Stata book recommendations
- A Gentle Introduction to Stata: A great companion for the trainings.
- The Workflow of Data Analysis using Stata: Provides helpful tips on organizing do files, working on teams, improving productivity, and reducing errors.
- An Introduction to Stata Programming: An advanced book on Stata programming.
- External Stata tutorials
- Stata at Berkeley
D-Lab works with Berkeley faculty, research staff, and students to advance data-intensive social science and humanities research. Our goal at D-Lab is to provide practical training, staff support, resources, and space to enable you to use R for your own research applications. Our services cater to all skill levels and no programming, statistical, or computer science backgrounds are necessary. We offer these services in the form of workshops, one-to-one consulting, and working groups that cover a variety of research topics, digital tools, and programming languages.
Visit the D-Lab homepage to learn more about us. You can view our calendar for upcoming events, learn about how to utilize our consulting and data services, and check out upcoming workshops.
- Renee Starowicz
- Isabelle Cohen
- Chris Kennedy
- Hero Ashman