stata

Execute Stata do-files via Bash using absolute paths and automatically retrieve logs.

⭐4stars🔀0forks📁View on GitHub🕐Updated Dec 4, 2025⬇️2downloads

When & Why to Use This Skill

This Claude skill enables the automated execution of Stata do-files through command-line integration, streamlining professional statistical analysis and econometric modeling. It optimizes the research workflow by handling absolute path execution, preventing interactive session freezes, and automatically retrieving detailed output logs for immediate data interpretation.

Use Cases

  • Automated Econometric Modeling: Execute complex regressions and statistical tests by running Stata scripts directly from the agent environment, with results captured in real-time logs.
  • Data Cleaning and Transformation: Automate large-scale data preparation tasks using Stata’s robust data manipulation commands without manual GUI intervention.
  • Reproducible Research Auditing: Ensure consistent execution of analysis scripts and maintain a verifiable record of results through automated log file management and retrieval.
  • Batch Processing for Research: Run multiple statistical simulations or data processing jobs in sequence, leveraging absolute paths for reliable file management across different directories.
namestata
descriptionExecute Stata do-files via Bash using absolute paths and automatically retrieve logs.

Stata Skill

Executable Path: "D:/Stata/StataMP-64.exe"

1. CODE GENERATION RULES (Mandatory)

Whenever you create or edit a .do file, you MUST insert these two lines at the very top:

capture log close        // Closes any previously open logs to prevent errors
set more off             // Prevents Stata from pausing for user input (freezing)

## Operational Instructions

### Correct Execution Example
If you want to run `analysis.do` located in `D:/Project/`:

powershell -Command "& \"D:/Stata/StataMP-64.exe\" /e do
      \"D:/AutoRegMonkey/workspace/analysis.do\""

工作目录设在workspace,log文件也输出到workspace
在根目录下读取同名的log文件,那是stata的输出