
Learn how to manage, manipulate, and analyze data with Stata, covering basics to advanced data visualization across its three sub courses: Essentials, tips for data, and data visualization in Stata.
Explore the Stata interface across Mac and PC, navigate the main window with results, command, and variable panes, and customize preferences for specialized editors.
Learn to navigate Stata's help features, including the help command, help viewer, the manual and PDFs, getting started guides, and online resources like the Stata Journal.
Explore Stata command syntax as the primary way to interact with data beyond the gui, mastering command arguments, optional brackets, and options to control analysis.
Learn how do files store Stata code, how do edit and the do command execute code, and how ado files enable modular, reusable data analysis in Stata.
Start, view, and manage Stata log files to record data sessions, using log for starting, closing, appending, or replacing, and translate logs for text editors.
Note: the do-file uses folder paths from my own computer (in commands such as cd, use, save and import excel). Replace them with a folder on your own computer before running the code.
Learn to view and edit raw data in Stata using the browse and edit commands, filter with if and in, and insert a new variable.
Explore basic descriptive statistics in Stata using describe and summarize to understand observations, variables, and data features, then learn how the codebook command generates a data codebook.
Learn to use the tabulate command in Stata to create one-way tables for categorical data. Explore two-way tables and summarize options, including missing values, no label, and row column percentages.
Discover how Stata handles missing values, coded as full stops and treated as positive infinity, and learn to identify, encode or decode, and tabulate missing observations.
Explore distributional statistics of continuous variables like price, using inspect, stem, and summarize detail, then test for normality with the src test in Stata.
Explore how to apply Stata weights to survey data, including frequency, sampling, analytical, and importance weights, and see their impact on descriptive, regression, and graph analyses.
Explore the redesigned Stata 17 table command, learn to build custom two-way and multi-variable tables, apply descriptive statistics, and export results to Excel, PDF, or Latex.
Learn to recode existing numerical variables in Stata using the recode command, merge sparse categories, and generate a new variable with rule-based mappings.
Generate new variables in Stata using the generate command and function transformations, such as price divided by weight and log price. Use replace to modify existing variables and verify summaries.
Rename single or grouped variables and set their labels using rename and label commands, and create value labels for categories. Explore the variable manager GUI and command-line options.
Explore egon, the extensions to generate in Stata, to create deciles with the cut function, compute standard deviation, and derive row means.
Learn to create indicator variables in Stata with generate, replace, or recode, including binary high price and multiple dummies from categorical data.
Learn to keep and drop data and variables in Stata using drop and keep commands, apply if conditions and wildcards, and work on a copy.
Note: the do-file uses folder paths from my own computer (in commands such as cd, use, save and import excel). Replace them with a folder on your own computer before running the code.
Convert string variables to numeric in Stata using the d string and the two string commands, then reverse with the same tools, and use encode and decode for non-numeric strings.
Loading the data: the four datasets for this lecture are in combining-data-datasets.zip under Resources (append1, append2, autosize and autoexpense). Unzip them into one folder. Save it to a folder on your computer, point Stata to that folder and load it:
cd "the folder where you saved the data" use append1, clear
If the do-file shows a folder from my own computer, use your own folder instead.
Learn how to use macros and foreach loops in Stata to shorten code, manage local and global macros, and automate multiple commands like summaries and regressions across variables.
Access stored results from Stata commands, including R-class and E-class outputs, to automate calculations and customize output using display, return list, matrix list, and underscore variables.
Explore multiple loops in Stata, using for each and for values to generate new variables by multiplying auto data variables by I values; see how double loops save time.
Loading the data: the data is attached under Resources as date.csv (and date.xls). The do-file loads date.dta; load the CSV instead and save it once as date.dta. Save it to a folder on your computer, point Stata to that folder and load it:
cd "the folder where you saved the data" import delimited date.csv, clear save date, replace
If the do-file shows a folder from my own computer, use your own folder instead.
Explore how underscore variables and by prefix enable group-based recoding in Stata, using subscripting to extract observations and calculate max or min values within each group.
Learn to create and customize Stata graphs with the graph command, overlay visuals with two way, save and reuse graphs, and apply schemes like economist scheme for publication-ready visuals.
Create bar graphs and dot charts in Stata, comparing category frequencies and summary statistics like price and standard deviation, with graphical user interface and do-file options.
Explore how to graph distributions in Stata, using histogram, kernel density plots, quantile plots, box plots, and glider to assess skewness and compare groups.
Explore pie charts to visualize categorical data with Stata, first via the graphical user interface, then by writing do-file code, including customization and group comparisons like domestic vs foreign.
Explore scatter plots and lines of best fit in Stata to visualize relationships, compare groups with two-way overlays, and assess linear, quadratic, and non-parametric fits with confidence intervals.
Learn how to graph custom functions in Stata using the two way function command to plot equations, distributions, and regression estimates over specified ranges.
Visualize three-dimensional data in two dimensions with contour plots in Stata, using a z variable to define contours and explore continuous by continuous interactions via margins.
Apply the jitter option to scatterplots to add random noise, revealing data distribution while protecting confidentiality. See how jitter clarifies crowded or binary data and enables visualization of sensitive relationships.
Learn how sunflower plots in Stata reveal data density in large bivariate datasets using sunflowers, hexagons, and petals, with bin width adjustments and optional two-way plots.
Learn to use sunflower plots in Stata to visualize density distributions of bivariate data with hexagons, petals, and color cues for high, medium, and low density.
Learn to adjust Stata graph sizes by using the aspect ratio option to reshape the plot region, plus y size, x size, and scale options to tune the whole graph.
Explore graphing by groups in Stata using the buy option to repeat graphs across subgroups, with suboptions like i scale, total, missing, row, column, and compact.
Apply graph color schemes and object-specific colors to Stata graphs, adjusting opacity, intensity, and rgb values for clear, print-friendly visuals.
Explore embedding custom markers and text in Stata graphs using starter code, with bold, italic, and Greek letters via Smiggle, and control titles, labels, and note text.
Learn to create scatter plots with categories in Stata by overlaying multiple y variables, using separate and collapse to generate summary data, and visualize by ethnicity.
Explore how two categorical variables relate using chi square and Fisher's exact tests in Stata, with tabulate, expected counts, p-values, and related measures.
This lecture demonstrates testing means in Stata, including one-sample and two-sample t tests, testing standard deviations and proportions, and using Hotelling's t-squared test and mean by plots to compare groups.
Explore Pearson's bivariate correlation in Stata using correlate and the pairwise command, with listwise and pairwise deletion, covariances, significance testing, and tetrachoric for binary variables.
Explore one-way and two-way analysis of variance in Stata, test mean differences, check equal variances, and use one way or anova commands with tabulate, reporting f statistics and p values.
Explore ordinary least squares regression in Stata using the regress command to model price with miles per gallon, weight, and length, and interpret coefficients, p-values, and R-squared.
Learn to include categorical variables in an OLS regression in Stata using the i. prefix to expand categories in real time, and set base or reference categories.
Explore diagnostic tools in Stata for OLS regression, including post estimation statistics, multicollinearity checks, outlier detection, functional form, heteroskedasticity tests, and visual diagnostics to improve model fit.
Explore how to improve regression models in Stata by transforming the dependent variable to log price, adding a quadratic miles per gallon term, and using margins plots to visualize interactions.
Learn to perform hypothesis tests after OLS regression in Stata, test single and joint coefficients, compare to nonzero values, use testparm, and compute linear combinations across lag variables.
Learn to present multiple OLS regression results in Stata by storing estimates with estimates store, compiling them into an estimates table, and exporting tidy tables to Word or Excel.
Standardized regression estimates reveal which variables matter most by rescaling variables to mean zero and unit variance. Practice in Stata uses beta and std beta, with cautions on interactions.
Before you run the code: this lecture uses the user-written command coefplot. Install it once in Stata with:
ssc install coefplot, replace
After that, the code in the resources runs as shown in the video.
Loading the data: the data is in oaxaca-data.zip under Resources (oaxaca.xlsx and oaxaca.do). Unzip it, then create oaxaca.dta once from the spreadsheet: Save it to a folder on your computer, point Stata to that folder and load it:
cd "the folder where you saved the data" import excel oaxaca.xlsx, firstrow clear save oaxaca, replace
If the do-file shows a folder from my own computer, use your own folder instead.
Explore linear mixed effects models with random intercepts and random slopes in Stata to improve fit over ordinary least squares, by estimating variance components and visualizing results.
Correction: to constrain all three slopes (mpg, weight and length) to be equal, use both constraints:
cnsreg price mpg weight length i.rep78, constraints(1 2)
constraints(2) on its own only makes the mpg and length slopes equal.
Compare nonlinear logit and probit models for binary outcomes in Stata, highlighting why linear probability models fail with out-of-bounds predictions and how maximum likelihood yields bounded probabilities.
Explore diagnostic statistics and interpretation of logit and probit regression, including goodness-of-fit measures, pseudo r-squared, classification tables, odds ratios, and marginal effects via margins.
Explore ordered and multinomial choice models in Stata, estimating ordered logit/probit with cut points, margins, and parallel regression checks, then apply multinomial logit with IEA tests and base categories.
Learn how to model fractional data bounded between 0 and 1 with beta regression, fractional logit/probit, and zero inflated beta regression in Stata, ensuring valid predictions.
Explore generating random numbers in Stata for Monte Carlo simulations, using a data generating process to control the environment, including normal and uniform draws with seeds.
Construct datasets from random generators to illustrate the data generating process, defining y as a function of x1, x2, and e1, and examine regressions and probit on binary outcomes.
Simulate data structures in Stata to examine what happens when data violate ordinary least squares assumptions through endogeneity and multicollinearity. Reveal bias, inefficiency, and higher standard errors in regression estimates.
Learn to perform Monte Carlo simulation in Stata by repeatedly generating random data, running regressions, and evaluating estimator bias through summaries and density plots.
Explore count data analysis and Poisson modeling in Stata, highlighting non-negative integers, equidispersion, zeros, and when to use Poisson or negative binomial regression instead of OLS.
Loading the data: the data is in count-data.zip under Resources (it contains count.dta). Unzip it first. Save it to a folder on your computer, point Stata to that folder and load it:
cd "the folder where you saved the data" use count.dta, clear
If the do-file shows a folder from my own computer, use your own folder instead.
Loading the data: the data is in count-data.zip under Resources (it contains count.dta). Unzip it first. Save it to a folder on your computer, point Stata to that folder and load it:
cd "the folder where you saved the data" use count.dta, clear
If the do-file shows a folder from my own computer, use your own folder instead.
Loading the data: the data is in count-data.zip under Resources (it contains count.dta). Unzip it first. Save it to a folder on your computer, point Stata to that folder and load it:
cd "the folder where you saved the data" use count.dta, clear
If the do-file shows a folder from my own computer, use your own folder instead.
Loading the data: the data is in count-data.zip under Resources (it contains count.dta). Unzip it first. Save it to a folder on your computer, point Stata to that folder and load it:
cd "the folder where you saved the data" use count.dta, clear
If the do-file shows a folder from my own computer, use your own folder instead.
Refreshed for 2026: new animated explainers across the Essential Stata and data visualisation parts, cleaner audio throughout, slides for the graph explainers, and 21 section quizzes plus a practice test.
The Complete Guide to Stata brings three of my courses together. It takes you from your first do-file to advanced models, gives you more than a hundred quick fixes for everyday problems, and shows you how to make and read 40 kinds of graph.
Part 1: Essential Stata (sections 2 to 17)
Stata from the ground up. Each topic opens with a short animated explainer and then moves into Stata, command by command, with real output and what it means.
Getting started, exploring data and manipulating data, including macros and loops
Graphs, statistical tests, correlation and ANOVA
Linear regression: diagnostics, hypothesis tests, presenting results, Oaxaca decomposition and mixed models
Logit and probit, ordered and multinomial models, fractional outcomes, simulation, count data and survival analysis
Panel data, difference-in-differences, instrumental variables and Heckman selection models
Epidemiological tables, power analysis and matrix operations
Part 2: Quick Stata Tips (sections 18 to 21)
Short, standalone videos on data management, statistics, programming and graphs. Each one solves a specific problem in a few minutes, so you can dip in whenever you need it.
Part 3: Data Visualisation (sections 22 to 26)
40 graph types for one continuous variable, one discrete variable, two variables, and three or more. Each graph gets an animated explainer (what it shows, how to read it, when it misleads) and then a Stata lecture where we build it step by step.
What you get
304 videos, about 26 hours in total
Do-files for the Stata lectures, plus data where a lecture doesn't use Stata's built-in datasets
Slides for the graph explainers as PDFs
21 section quizzes and a 97-question practice test
How to use it
New to Stata? Start with Part 1 and work through it in order. Already comfortable? Go straight to the tips or the graphs, or use the course as a reference: every section stands on its own.
I've used Stata for 20 years in research and teaching, and this course puts the most useful parts of it in one place.