Stata 18, released in April 2023, introduced major upgrades focusing on Bayesian model averaging, causal mediation analysis, and enhanced data management tools. It is designed to be a robust, user-friendly platform for researchers in fields like economics, epidemiology, and political science. Key New Features The most significant updates in Stata 18 include:
* At top of every do-file
version 18
clear all
set more off
set linesize 80
* Set working directory relative to do-file (requires do-file location)
cd `c(pwd)'
| Feature | Stata 17 | Stata 18 |
|---------|----------|----------|
| Bayesian multilevel | No | Yes (bayes: meglm) |
| Heterogeneous DID | Limited | Full (Callaway-Sant’Anna, Sun-Abraham) |
| Python integration | Basic (via python command) | Bidirectional with pandas/NumPy support |
| Small-area estimation | User-written only | Native sae command |
| PNG/PDF export to PowerPoint | No | Yes (putpptx) |
| Stata Markdown | No | Yes (.smd files) |
| Caching for reproducibility | No | Yes (hash-based) |
| Performance (large merges) | Baseline | ~25% faster | Stata 18
All deprecated commands still work in Stata 18 but will produce a warning. They are scheduled for removal in Stata 19. Stata 18, released in April 2023, introduced major
Stata 18 is a "practitioner’s release." While it may not introduce a brand-new statistical philosophy on the scale of the Bayesian suite in Stata 14 or Lasso in Stata 16, it provides the essential tools required for modern applied research. Comparing Stata 18 vs
python:
from sfi import Data
import pandas as pd
df = pd.DataFrame('y': Data.get('y'), 'x': Data.get('x'))
# Do scikit-learn, etc.
Data.store('pred', predictions, None)
end
| Situation | Solution | Example |
|-----------|----------|---------|
| Large panel | xtset, force + xtreg, re | xtset id year, force |
| 10M+ obs | use with in or if early | use data if year>2020, clear |
| Slow merge | joinby then collapse? | joinby id using other |
| Memory blow | compress + recast | recast int id, force |
| Loops | forvalues > foreach > while | forvalues i=1/1000 ... |