Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Cleans, transforms, and validates messy research datasets in Stata, producing reproducible analysis-ready files with change logs.
80% 96%+16 ptsof test cases passed
Passed 24 of 25 test cases with the skill, and 20 of 25 without it.
In Stata, you have a phone number string variable 'phone_str' formatted with symbols like '(555) 019-2831'. Write a Stata command to strip away all non-numeric characters using regular expressions.
Employs the regex pattern [^0-9] to match non-digit characters.
3 of 3 safety checks passed
Clean, transform, and validate messy research datasets in Stata. This skill covers the complete data preparation pipeline from raw survey or administrative data to analysis-ready datasets, with emphasis on documentation, reproducibility, and handling the common data quality issues encountered in social science, economics, and health research.
Data cleaning typically consumes 60-80% of research time in empirical studies, yet it is often under-documented and poorly reproducible. Stata provides a powerful set of commands for data manipulation, but knowing which commands to use and in what order requires experience with common data quality issues: inconsistent coding, duplicate observations, string formatting problems, implausible values, and complex missing data patterns.
This skill provides a systematic, step-by-step data cleaning workflow in Stata. Each step produces a log of changes made, enabling full reproducibility and audit trails. The workflow is organized around the principle that raw data should never be modified in place -- instead, cleaning scripts transform raw data into processed datasets while preserving the original.
The approach follows best practices from the World Bank's DIME Analytics team and the J-PAL research transparency guidelines, making it suitable for projects that require rigorous data documentation for peer review, replication packages, or regulatory compliance.
* ============================================
* Data Cleaning Script: [Project Name]
* Author: [Name]
* Date: [Date]
* Input: raw/survey_data_raw.dta
* Output: processed/survey_data_clean.dta
* ============================================
clear all
set more off
log using "logs/cleaning_log.smcl", replace
* Load raw data
use "raw/survey_data_raw.dta", clear
* Basic inspection
describe
summarize
codebook, compact
* Check dimensions
display "Observations: " _N
display "Variables: " c(k)
Published skills whose descriptions closely match this one, with their benchmark result.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.