Open-SAS VS Code Extension
SAS-style statistical analysis syntax highlighting and execution support for VS Code
SAS® is a registered trademark of SAS Institute Inc. Open-SAS is not affiliated with, endorsed by, or sponsored by SAS Institute Inc.
Features
- Syntax Highlighting: Full SAS-style statistical analysis syntax highlighting for
.osas
and .sas
files
- Code Snippets: Common statistical analysis patterns and procedures
- File Execution: Run SAS-style Open-SAS files directly from VS Code
- Notebook Support: Interactive statistical notebooks (both
.ipynb
with osas kernel and .osasnb
files)
- IntelliSense: Code completion and syntax checking
- Integrated Terminal: View results in VS Code's integrated terminal
Installation
- Install the extension from the VS Code Marketplace
- Install the Open-SAS Python package:
pip install open-sas
- Install the Jupyter kernel (optional, for notebook support):
python -m open_sas.kernel install
Usage
Basic SAS-Style Files (.osas)
- Create a new file with
.osas
extension
- Write your SAS-style code
- Use
Ctrl+Shift+P
→ "Open-SAS: Run File" to execute
- View results in the integrated terminal
Interactive Notebooks
Option 1: Standard Jupyter Notebooks (.ipynb)
- Install the Open-SAS kernel:
python -m open_sas.kernel install
- Create a new Jupyter notebook (
.ipynb
)
- Select "osas" as the kernel
- Write SAS-style code in cells and execute
Option 2: Open-SAS Notebooks (.osasnb)
- Create a new file with
.osasnb
extension
- Write SAS-style code in cells
- Execute cells individually or run all
- View formatted output and datasets
Code Snippets
Type common statistical analysis patterns and press Tab
to expand:
data
→ DATA step template
proc
→ Statistical procedure template
means
→ PROC MEANS template
freq
→ PROC FREQ template
reg
→ PROC REG template
sql
→ PROC SQL template
macro
→ Macro definition template
Supported Features
- DATA Steps: Variable creation, conditional logic, DATALINES
- PROC MEANS: Descriptive statistics with CLASS variables and OUTPUT statements
- PROC FREQ: Frequency tables and cross-tabulations with options
- PROC SORT: Data sorting with ascending/descending order
- PROC PRINT: Data display and formatting
- PROC REG: Linear regression analysis with MODEL, OUTPUT, and SCORE statements
- PROC SURVEYSELECT: Random sampling with SRS method, SAMPRATE/N options, and OUTALL flag
- PROC UNIVARIATE: Detailed univariate analysis with distribution diagnostics
- PROC CORR: Correlation analysis (Pearson, Spearman)
- PROC FACTOR: Principal component analysis and factor analysis
- PROC CLUSTER: Clustering methods (k-means, hierarchical)
- PROC NPAR1WAY: Nonparametric tests (Mann-Whitney, Kruskal-Wallis)
- PROC TTEST: T-tests (independent and paired)
- PROC LOGIT: Logistic regression modeling
- PROC TIMESERIES: Time series analysis and seasonal decomposition
- PROC TREE/FOREST/BOOST: Machine learning (decision trees, random forests, gradient boosting)
- PROC SQL: SQL query processing with DuckDB backend
- PROC LANGUAGE: Built-in LLM integration for text generation and analysis
- SAS Macro System: %MACRO/%MEND, %LET, & substitution, %PUT, %IF/%THEN/%ELSE, %DO/%END
- SAS Format System: Built-in date/time, numeric, and currency formats with metadata persistence
- Macro Variables: %LET, %PUT statements
- Libraries: LIBNAME functionality
- TITLE Statements: Title support for output formatting
Configuration
The extension can be configured through VS Code settings:
open-sas.pythonPath
: Path to Python executable
open-sas.openSASPath
: Path to Open-SAS runner script
open-sas.showOutputOnRun
: Show output channel when running code
Requirements
- Python 3.8 or higher
- Open-SAS Python package
- VS Code 1.60.0 or higher
Demo
Check out the comprehensive demo in examples/osas_walkthrough.ipynb
to see all features in action.
Contributing
Contributions are welcome! Please see the main project repository for contribution guidelines.
License
MIT License - see LICENSE for details.
Support
⚖️ Legal Disclaimer
SAS® is a registered trademark of SAS Institute Inc. Open-SAS is not affiliated with, endorsed by, or sponsored by SAS Institute Inc.
This extension uses original, independently developed code to implement statistical functionality using SAS-like syntax for educational and analytical use. It is not a clone, derivative, or replacement for SAS software and does not use any proprietary code from SAS Institute.
Open-SAS is provided as-is, under an open-source license, for research and community contribution purposes.