brycewang-stanford/auto-empirical-research-skills/stata-data-cleaning
Claude Code and agent skill by brycewang-stanford/auto-empirical-research-skills
- community
Checking that the SKILL.md file is still in the repository.
Clean and transform messy data in Stata with reproducible workflows
Install
npx vskill@latest install brycewang-stanford/auto-empirical-research-skills/stata-data-cleaningSKILL.md
The same SKILL.md was published earlier as brycewang-stanford/auto-empirical-research-skills/stata-data-cleaning.
Stata Data Cleaning
Purpose
This skill helps economists clean, transform, and prepare datasets for analysis in Stata. It emphasizes reproducibility, proper documentation, and handling common data quality issues found in economic research.
When to Use
- Cleaning raw survey or administrative data
- Merging multiple data sources
- Handling missing values, duplicates, and outliers
- Creating analysis-ready panel datasets
- Documenting data transformations for replication
Instructions
Step 1: Understand the Data
Before generating code, ask the user:
- What is the data source? (survey, administrative, API, etc.)
- What is the unit of observation?
- What are the key variables needed for analysis?
- Are there known data quality issues to address?
Step 2: Generate Cleaning Pipeline
Create a Stata do-file that:
- Has a clear header with project info and date
- Sets up the environment (clear all, set memory, log)
- Loads and inspects raw data
- Documents each transformation with comments
- Creates a codebook for the final dataset
Step 3: Follow Best Practices
- Use
assertstatements to verify data integrity - Create labeled variables with
label variable - Use value labels for categorical variables
- Generate a log file for reproducibility
- Save intermediate files when appropriate
Example Output
Requirements
Software
- Stata 15+ (some commands require newer versions)
Recommended User-Written Commands
Best Practices
- Always start with `clear all` to ensure clean environment
- Use log files to document all transformations
- Comment extensively - explain WHY, not just WHAT
- Use `assert` statements to catch data errors early
- Create a data dictionary alongside your cleaned data
- Version your do-files and datasets
Common Pitfalls
- ❌ Not checking for duplicates before merging
- ❌ Forgetting to handle missing value codes (-99, -88, etc.)
- ❌ Not labeling variables and values
- ❌ Overwriting raw data files
- ❌ Not documenting data transformations
References
- Stata Data Management Manual
- Gentzkow & Shapiro (2014) Code and Data for the Social Sciences
- DIME Analytics Data Handbook
Changelog
v1.0.0
- Initial release with comprehensive cleaning template
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/09-meleantonio-awesome-econ-ai-stuff/_skills/data/stata-data-cleaning/SKILL.md
Popularity
- Repository stars
- 4,455
- Repository forks
- 532
- 7-day trend score
- 42
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/brycewang-stanford/auto-empirical-research-skills/stata-data-cleaning)