Comprehensive Stata reference for writing correct .do files, data management, econometrics, causal inference, graphics, Mata programming, and 20 community packages (reghdfe, estout, did, rdrobust, etc.). Covers syntax, options, gotchas, and idiomatic patterns.
SkillScore100Maintained
Automatic
◆Data Analyst pack
Last verified 8/7/2026
What it changes
Passed 22 of 22 test cases with the skill, and 17 of 22 without it.
Without skill77%
With skill100%
Checks it passed that the model alone missed
Uses the csdid command
Uses the reghdfe command
Prefixes the department variable with i.
and 4 more in the full report
5 fixed17 passed either way0 still failing0 broke
Pass-rate lift
+23 pp
Tokens
+267%
Agent turns
0%
Response time
-36%
Model gemini-3.6-flashMeasured 8/7/2026v322 of 22 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 5
Prompt
Create a new indicator variable 'high_score' that equals 1 if 'score' is strictly greater than 90, and 0 otherwise. The dataset contains missing values, which must not be flagged as high scores.
What was checked, without and with the skill
Checked
Without skill
With skill
Explicitly excludes missing values using !missing(score) or score < .
Missed
Passed
case-01 · gemini-3.6-flash · 8/7/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md320 linessingle file
Stata Skill
You have access to comprehensive Stata reference files. Do not load all files.
Read only the 1-3 files relevant to the user's current task using the routing table below.
Critical Gotchas
These are Stata-specific pitfalls that lead to silent bugs. Internalize these before writing any code.
Missing Values Sort to +Infinity
Stata's . (and .a-.z) are greater than all numbers.
* WRONG — includes observations where income is missing!
gen high_income = (income > 50000)
* RIGHT
gen high_income = (income > 50000) if !missing(income)
* WRONG — missing ages appear in this list
list if age > 60
* RIGHT
list if age > 60 & !missing(age)
= vs ==
= is assignment; == is comparison. Mixing them up is a syntax error or silent bug.
* WRONG — syntax error
gen employed = 1 if status = 1
* RIGHT
gen employed = 1 if status == 1
Local Macro Syntax
Locals use `name' (backtick + single-quote). Globals use $name or ${name}.
Forgetting the closing quote is the #1 macro bug.
Design, run, and critique causal inference workflows in Stata. Use when the user is working on identification, treatment effects, DiD, IV, event studies, RD, or assumption-sensitive empirical claims.