stata-cli
Use stata-cli as the default local entrypoint for Stata tasks in AI agent.
This skill now includes a local reference library. Do not load everything. Read only the 1-3 files relevant to the current task.
Core workflow
For AI-driven work:
mkdir my-analysis
cd my-analysis
stata-cli init
stata-cli file do/analysis.do
stata-cli data view --input-dta /absolute/path/to/data.dta --max-rows 20
stata-cli data export-csv --input-dta /absolute/path/to/data.dta --output /absolute/path/to/out.csv --replace
Routing table
Read only the files relevant to the task. Paths are relative to this SKILL.md.
Basics and workflow
references/basics-getting-started.mdreferences/workflow-best-practices.mdreferences/programming-basics.mdreferences/advanced-programming.md
Data work
references/data-management.mdreferences/data-import-export.mdreferences/string-functions.mdreferences/date-time-functions.mdreferences/variables-operators.mdreferences/mathematical-functions.md
Statistics and econometrics
references/descriptive-statistics.mdreferences/linear-regression.mdreferences/panel-data.mdreferences/time-series.mdreferences/limited-dependent-variables.mdreferences/bootstrap-simulation.mdreferences/survey-data-analysis.mdreferences/missing-data-handling.mdreferences/maximum-likelihood.mdreferences/gmm-estimation.md
Stata 19 features (verified on Stata 19.5)
references/panel-var-xtvar.md— panel VAR (xtvar)references/high-dimensional-fixed-effects.md— HDFE absorption inareg,xtreg, fe,ivregress 2slsreferences/cate.md— conditional average treatment effects (cate)references/weak-instruments.md— weak-instrument-robust inference (estat weakrobust)references/control-functions.md— control-function models (cfregress,cfprobit)references/svar-with-iv.md— SVAR via instruments (ivsvar)references/iv-local-projections.md— IV local projections (ivlpirf)references/correlated-random-effects.md— CRE model and Mundlak test (xtreg, cre,estat mundlak)references/gmm-xtinstruments.md— GMM with panel-style instruments (gmm ... xtinstruments())
Causal inference and advanced methods
references/difference-in-differences.mdreferences/regression-discontinuity.mdreferences/matching-methods.mdreferences/treatment-effects.mdreferences/sample-selection.mdreferences/nonparametric-methods.mdreferences/sem-factor-analysis.mdreferences/survival-analysis.mdreferences/spatial-analysis.mdreferences/machine-learning.md
Graphics, tables, and reporting
references/graphics.mdreferences/tables-reporting.md
Mata
references/mata-introduction.mdreferences/mata-data-access.mdreferences/mata-matrix-operations.mdreferences/mata-programming.md
Community packages
packages/package-management.mdpackages/reghdfe.mdpackages/estout.mdpackages/coefplot.mdpackages/winsor.mdpackages/event-study.mdpackages/rdrobust.mdpackages/synth.mdpackages/ivreg2.mdpackages/xtabond2.mdpackages/binsreg.mdpackages/nprobust.mdpackages/asdoc.mdpackages/data-manipulation.mdpackages/graph-schemes.md
Practical defaults
- If the task is more than a few lines, initialize a workspace and write
do/analysis.do. - If the user already has a project folder, keep outputs inside its
outputs/directory. - If charts are needed, prefer exporting tidy results from Stata and plotting with Python.
- If a package is needed but may not be installed, check with
whichbefore using it.
When failure
If setup looks wrong, run:
stata-cli doctor