Stata All in One
One VS Code extension tailored for Stata users
| Version: 0.3.7 | Author: Zihao Viston Wang | Translate:
中文版本 |
All-in-one Stata experience: Code Execution + Syntax Highlighting + Code Completion + Smart Outline + Data Viewing + AI Skill!
Ready out of the box! Natively integrated into VS Code—no need to configure external environments like Python or Node.js.
Stata All in One is derived from Stata Outline, expanded with new features and improvements.
Acknowledgments
First, my thanks go to RedNote user Rich**d, WeChat users M*k*, 柿**橙, and the anonymous user who commented “功能强大且配置简单的插件,谢谢!”, and Buy Me a Coffee supporters LB**PG@gmail.com and ol***ba@gmail.com for their generous contributions and continued support of this project.
Above all, I am deeply grateful to the Agricultural Economics and Management Innovation Team at Northwest A&F University for supporting my research, providing funding, and helping promote and publicize this project.
I am also sincerely grateful to Assoc. Prof. Yujun Lian and the lianxh.cn team for their patient guidance and publicity support.
Finally, I thank Stata's officially authorized distributor Beijing Uone Info&Tech Co.,Ltd (Uone-Tech) for its support in promoting and publicizing this project.
Features
Click to view full image
⚠️ Features marked with 🛠️ require Stata 17 or later and a STATA.LIC license file. Please support genuine Stata software to enjoy the full experience. You can contact Stata Corp, LLC's officially authorized partner Beijing Uone Info&Tech Co.,Ltd (Uone-Tech) to purchase genuine Stata software or request a trial.
1. AI Skill (Experimental) 🛠️
- Let AI Agents Run Stata Code: Install the standalone native
stata-ai-skill so AI coding tools (Claude Code, Cursor, Codex CLI, Open Code, OpenClaw, etc.) can run Stata through a Rust background service.
- Native Local Service: Once installed, the AI Skill runs through its native executable and local service.
- Leave the setup to AI: Click the
AI button in the editor toolbar, copy the prompt, and paste it into your AI tool. The prompt links to the online installation.md through Gitee and GitHub.
- Lightweight Extension: AI Skill executables are installed only when needed and are no longer bundled with this extension.
2. Code Execution (Stata Interaction)
- Platform Support: Seamlessly integrates with Stata on both macOS and Windows without requiring additional extensions.
- Two Run Modes:
- Embedded Console (default) 🛠️: Run and display Stata output directly within VS Code! Including command results, error messages, command window output, and graph output — a true all-in-one IDE experience. Click any file path shown in the Console output to open it.
- External App: Continue using the traditional approach of sending code to the Stata GUI, for users who prefer Stata's native interface. Windows now uses Stata COM Automation, delivering significantly better performance than the previous PowerShell-based implementation.
- Multi-Scenario Execution Strategies:
- Section Execution: When the cursor is on a header line (e.g.,
** # Title), click the ▶️ button or press Ctrl/Cmd + D to execute all code from that header to the next same-level or higher-level header (i.e., the entire section).
- Single Line Execution: When the cursor is on a regular code line (no selection), click the ▶️ button or press
Ctrl/Cmd + D to execute only that specific line.
- Selected Code Execution: When multiple lines are selected, click the ▶️ button or press
Ctrl/Cmd + D to execute the selected lines. Supports fuzzy selection — no need to precisely select the first or last line of a code segment; the system automatically captures and runs all lines covered by the selection.
3. Enhanced Syntax Highlighting & Code Completion
- Full Syntax Highlighting and Code Completion Support: Integrates Stata Enhanced syntax engine[^1], providing precise syntax highlighting and code completion for
.do files (under MIT License).
- Custom Command Highlighting: Supports highlighting for commonly used third-party commands (e.g.,
reghdfe, ivreghdfe, gtools), freely configurable in settings.
- Dataset Variable Autocompletion: (After running code once) Provides intelligent autocomplete suggestions based on the current dataset when typing variable names in the editor and console, boosting coding efficiency.
[^1]: Stata Enhanced syntax engine was developed by Kyle Barron, providing comprehensive support for the Stata language. This extension follows the MIT License. Thanks to Kyle Barron for his contribution!
4. Smart Outline & Structural Navigation
- Multi-level Outline Recognition: Automatically detects comment lines from
**# to **###### as hierarchical headers, supporting up to 6 levels.
- Shortcuts:
Ctrl/Cmd + 1-6 to quickly convert to the corresponding header level; Ctrl/Cmd + 0 to revert to a standard code line.
- Cursor Auto-Follow: The outline view automatically highlights and navigates to the corresponding section as the cursor moves in the editor.
- Setup: Click the "···" button in the top-right of the Outline view and check "Follow Cursor".[^2]
- Multi-level Numbering: Optional display of logical numbering (e.g.,
1.1, 1.2.1) within the outline (must be enabled in settings).
- Auto-Sync Numbering: When enabled, the extension automatically adds or removes numbering directly within the
.do file based on the outline structure.
program define Block Recognition: Displays program names in the outline view for easy navigation and management of custom programs.
[^2]: Sorry~ This is a VS Code GUI setting, I cannot control it through the extension.
5. Data Viewer 🛠️
- Click to View: Click a
.dta file in the VS Code Explorer to open it in the new Data Viewer panel.
- Variable Info: Variable table displays metadata such as name, label, and type.
- Data Browsing: Supports lazy loading of rows and columns — easily browse large datasets right in VS Code without opening Stata.
- View After Run: After running code, instantly view results in the
Data Viewer within the Console panel.
- Data Filtering: Provides Stata-style filtering for quickly locating subsets of data.
- Handy Extras:
- Built-in
br / browse: In Embedded Console mode, run br or browse from either the code editor or Console input to open the built-in Data Viewer.
- View Long Text: If a cell contains more text than it can display, hover over the cell to view the full content.
- Double-click to Copy: Double-click a cell to copy its full content to the clipboard.
6. Efficient Separator Lines & Styling
- Quick Insertion: Supports various symbols to significantly enhance code readability.
- Standard Separators: Use
Ctrl/Cmd + Symbol to quickly insert separator lines:
Ctrl/Cmd + - (Dash) | Ctrl/Cmd + = (Equal) | Ctrl/Cmd + Shift + 8 (Asterisk)
- Custom Separators:
Ctrl + Alt + S (Windows) | Ctrl + Cmd + S (macOS), where S stands for "Separator".
- After pressing the shortcut, simply input your desired character to generate the corresponding separator line.
- Intelligent Wrap Mode:
- Blank Line Insertion: Generates a full-width separator line (length adjustable in settings).
- Non-blank Line Insertion: Pressing the shortcut once inserts above the line; pressing it again inserts below, creating a "wrapped" effect.
- Header Decoration: Select some characters of a header and press the shortcut to generate a title with balanced decorative symbols (e.g.,
**# === Title ===), without affecting outline recognition.
- Centered Header: If using Header Decoration + Custom space separator, the header content will be automatically centered.
7. More Features
Enhanced Embedded Console 🛠️
Graph Output
- Direct Display: Render Stata graph output directly in the embedded console.
- Export Options: Save graphs as SVG, PNG (configurable DPI), or copy to clipboard.
- Fullscreen View: Click a graph to view it in fullscreen mode for detailed inspection.
Progress Display
- Command Execution Status: For long-running commands like
bootstrap, bdiff, and xthreg, the console shows real-time progress (e.g. 50/2000) and estimated time remaining. Other commands display elapsed time.
Custom Font:
- Online (Default): Load Maple Mono for Latin text and Maple Mono NF CN for Chinese text.
- Font Settings: Use
stata-all-in-one.consoleFontMode and stata-all-in-one.consoleCustomFontFamily to customize the console font for a better reading experience.
Enhanced Comments
- Toggle Comments: Quickly toggle line comments using
Ctrl/Cmd + /.
- Optional Styles: Defaults to
//, with support for switching to other valid Stata comment delimiters in settings.
Built-in Help
- Show Help Text: For example, select
regress and press Ctrl/Cmd + Shift + H. In External App mode, this opens Stata's regress help page; in Embedded Console mode, the help text is displayed directly in the console.
- Hover Help: Hover over a Stata command to see help information, with automatic filtering of non-practical commands like
#delimit, using, etc.
Smart Line Break
- One-Key Line Break: Use
Shift+Enter to insert Stata line continuation symbol /// at the cursor position.
- Smart Indentation: Automatically indent by 4 spaces
Safe Rename Mode
- Rename Variable: Select a variable and press
F2 to rename all occurrences in the current document.
- Smart Validation: Automatically validates the new name to ensure it follows Stata naming rules and does not conflict with built-in commands or keywords.
- Command Protection: Intelligently prevents renaming Stata commands (e.g.,
reghdfe, outreg2) and their options (e.g., absorb, ctitle).
Auto cd to Do File Directory
- Auto Working Directory: When enabled, automatically sets Stata's working directory to the do file's location on first launch.
Quick Settings
- Settings Button: Click the gear icon in the editor title bar to quickly access Stata All in One settings.
Keyboard Shortcuts
Click here to view the complete list of keyboard shortcuts.
Installation
Install from Extension Marketplace
- VS Code: Search for "Stata All in One" in extensions and install.
Download and Install (for Cursor, Trae and other VSCode-based IDEs)
- Download
stata-all-in-one-x.x.x.vsix from either source:
- Open Extensions panel in your editor →
... → Install from VSIX....
- Select the downloaded
.vsix file to complete installation.
Configuration
Search for "Stata All in One" in VS Code settings and configure:
AI Skill
Click the AI button in the Stata editor toolbar to copy a prompt containing Gitee and GitHub links to the online installation.md. After installation, your AI coding tool follows the installed Skill's SKILL.md for service startup, status checks, Stata configuration, and subsequent operations.
If automatic discovery cannot find Stata, choose Stata not found? Configure it directly from Stata. The extension provides two commands to copy and run in a separately opened Stata application outside VS Code:
net install saio, from("<extension>/stata/saio") replace
saio setup
The saio package supports Stata 13 and later without Java, Python, curl, or third-party dependencies. It connects only to the extension's persistent local service on 127.0.0.1:16886–16895, prints the existing configuration first, and asks before replacing an existing setup. Use saio status for a read-only check or saio setup, force for unattended reconfiguration. VS Code blocks saio in the editor and Embedded Console because an already usable VS Code Stata session does not need this setup command.
Code Execution
Run Mode (stata-all-in-one.runMode)
embeddedConsole (default): Run code in the built-in Console | Stata All in One panel within VS Code, with direct output viewing and interaction.
externalApp: Send code to the system-installed Stata application for execution.
Stata Version on macOS (stata-all-in-one.stataVersionOnMacOS)
- Stata runtime version. When empty, the extension detects installed versions at startup for up to 3 seconds, preferring the highest numeric version and then
StataMP, StataSE, StataBE, and StataIC. If detection fails, configure directly from the running Stata instance. The initializer then verifies the exact .app, Console dylib, and stata.lic, initializes the Embedded Console when possible, and reports the result once in a central dialog.
Stata Path on Windows (stata-all-in-one.stataPathOnWindows)
- Path to Stata executable file (e.g.,
C:\Program Files\Stata17\StataMP-64.exe). When empty, the extension runs the bundled scripts/discover_stata_windows.bat registry probe at startup for up to 5 seconds. The same BAT can be run independently to generate stata-discovery-report.json for troubleshooting. If detection fails, configure directly from the running Stata instance. The initializer then verifies the EXE, Console DLL, and stata.lic, initializes the Embedded Console when possible, and reports the result once in a central dialog.
Close Stata Other Windows Before Sending Code (Windows) (stata-all-in-one.closeStataOtherWindowsBeforeSendingCode)
true: Close Stata helper windows (such as Viewer/Data Editor) before sending run commands.
false (default): Keep those windows open and send code directly.
Auto cd to Do File Directory (stata-all-in-one.cdToDoFileDir)
true (default): Automatically set Stata's working directory to the do file's location on first launch.
false: Stata's working directory is not changed on startup.
Show Action Buttons (stata-all-in-one.showActionButtons)
true (default): Show the "Bug Report" and "Stata AI Skill" buttons in the editor title bar.
false: Hide both buttons.
Show Sponsor Button (stata-all-in-one.showSponsorButton)
true: Show the "Sponsor" button in the Stata editor title bar.
false (default): Hide the button.
Enable Ctrl+Shift+D for Run Shortcut (stata-all-in-one.enableCtrlShiftD)
true: Use Ctrl/Cmd+Shift+D as the run code shortcut.
false (default): Use the default Ctrl/Cmd+D shortcut.
Embedded Console
- Console Font Mode (
stata-all-in-one.consoleFontMode)
online (default): Load Maple Mono for Latin text and Maple Mono NF CN for CJK text. [^3]
editor: Follow the editor font, falling back to the system monospace font.
system: Use the system monospace font directly.
custom: Use the custom font specified below.
[^3]: Font credits: subframe7536/maple-font, fontsource, and ZeoSeven Fonts (443, 442).
- Console Custom Font Family (
stata-all-in-one.consoleCustomFontFamily)
- When font mode is set to
custom, the CSS font-family list used by the console.
- Example: "Maple Mono NF CN", Menlo, Monaco, monospace
- Graph Export DPI (
stata-all-in-one.graphPngDpi)
- DPI value for saving embedded console graphs as PNG. Default
600, range 72–1200.
Syntax Highlighting and Code Completion
- Custom Command Highlighting (
stata-all-in-one.customCommands)
- User-defined Stata commands to highlight as keywords (array of strings). Default:
reghdfe.
- Example:
["reghdfe", "ivreghdfe", "gtools", "winsor2", "outreg2"]
- Requires reloading window after configuration.
Hover Help
Enable Hover Docs (stata-all-in-one.enableHoverDocs)
true (default): Show official Stata help information when hovering over Stata commands.
false: Disable hover help.
Additional ADO Paths (stata-all-in-one.additionalAdoPaths)
- Extra Stata ADO paths for scanning help files of community-contributed commands.
- Example:
["/Users/username/ado/personal", "C:\\Users\\username\\ado\\personal"]
Outline & Navigation
Display Multi-level Numbering (stata-all-in-one.numberingShow)
true: Outline displays 1.1, 1.2.1 style numbering.
false (default): Displays original headings.
Auto-update Heading Numbering (stata-all-in-one.numberingAdd)
true: When numbering is enabled, automatically update section titles in .do files to include numbers.
false (default): Only displays numbering in outline, doesn't modify file.
Note: Changes to numberingShow, numberingAdd, and customCommands require reopening .do files to take effect. When numberingAdd is disabled, existing numbering in .do files will be automatically removed.
Code Style
Comment Style (stata-all-in-one.commentStyle)
// (default): Comment style used for toggling comments. Options include //, *, or /* ... */
Separator Length (stata-all-in-one.separatorLength)
- Total character length of the separator line (including the
** # prefix and separators). Default: 60
- Separator Symmetric (
stata-all-in-one.separatorSymmetric)
true: Add ** at the end of separator lines to ensure visual symmetry (e.g., ** === Title === **).
false (default): Separator lines without the suffix.
Buy me a coffee
If this extension has been helpful to you, feel free to scan the Alipay (left), WeChat (middle), or Buy Me a Coffee (right) QR code below to support ☕
Changelog
| Version |
Changes |
Release Date |
| 0.3.7 |
Fixed standalone file-path detection in Embedded Console and corrected the duplicated Update Notice prefix. |
2026-07-24 |
| 0.3.6 |
Added one-click file opening from Embedded Console output, improved Data Viewer interactions, and fixed graph ordering and Console reset behavior. |
2026-07-24 |
| 0.3.5 |
Moved Stata AI Skill online, reducing the Stata All in One extension package to 2.48 MB; fixed Tab recognition between code tokens. |
2026-07-22 |
| 0.3.4 |
Rebuilt the Data Viewer with direct .dta and Console-memory access and improved native stability on macOS and Windows. |
2026-07-22 |
| 0.3.3 |
Improved Embedded Console command compatibility and multi-line browse routing, and refined which output rendering. |
2026-07-21 |
| 0.3.2 |
Focused on improving Stata initialization and intelligent autocomplete, while adding multi-format Console export, built-in data browsing commands, and Stata AI Skill v1.1 |
2026-07-17 |
| 0.3.1 |
Streamlined Stata startup setup with automatic installation discovery and runtime checks to minimize manual configuration |
2026-07-13 |
| 0.3.0 |
Stable release: Fixed known issues from the preview releases |
2026-07-06 |
See CHANGELOG.md for full version history.
| |