OpenSAS

OpenSAS

Run a tested subset of SAS 9.4 with an open-source local interpreter

Open Source

Gallery

About OpenSAS

OpenSAS is an open-source interpreter for a practical subset of the SAS 9.4 language. It is built in Zig and distributed as a standalone binary for running SAS programs without connecting to the proprietary SAS runtime. KIRHA created it with coding agents and evaluates the result against reference outputs rather than treating generated code as correct by default. The initial scope is clinical trial programming, where teams often need to produce and check CDISC datasets inside controlled environments. It can also serve developers and agents that need an executable feedback loop while writing supported SAS code.

A program runs from the command line through the included sas binary. OpenSAS accepts regular SAS source files, resolves libraries from directories, and can read or write common data formats used in clinical workflows. A library member can map to SAS7BDAT, XPT, or CSV files, while import and export procedures also cover delimited files and XLSX. Releases are provided for Linux on arm64 and x86_64, Windows on x86_64, and macOS on arm64. Developers can build it from source with Zig when they need a different workflow or want to contribute to the interpreter itself.

The implemented language surface goes well beyond a syntax demo. It includes the DATA step, assignments, conditionals, loops, arrays, retained values, multiple output targets, data selection options, BY-group processing, merge and set operations, and hash objects. The macro language supports nested macros, local and global variables, conditional and iterative expansion, quoting functions, indirect references, includes, and autocall libraries. OpenSAS also documents hundreds of built-in functions, numeric and character formats, date and time handling, and user-defined formats through PROC FORMAT. That coverage is intended to support full programs, not isolated expressions.

Supported procedures include PRINT, SORT, MEANS, SUMMARY, FREQ, UNIVARIATE, TRANSPOSE, REPORT, TABULATE, SQL, DATASETS, COMPARE, CONTENTS, FORMAT, IMPORT, EXPORT, and DELETE. The project reads and writes SAS7BDAT and XPORT files and provides CSV-backed libraries. Its clinical focus is visible in the end-to-end examples, which include SDTM and ADaM pipelines and a complete demographics mapping example. OpenSAS is not a replacement for every part of the SAS ecosystem. Modeling, survival analysis, and graphics procedures such as GLM, MIXED, LOGISTIC, LIFETEST, GPLOT, and SGPLOT are explicitly listed as unavailable.

Verification is one of the project's stronger design choices. The repository describes unit tests beside the code, a conformance corpus made from small programs, and end-to-end programs that compare output columns and values with golden datasets. File readers and writers are round-tripped against files produced by SAS 9.4. For supported programs, KIRHA reports byte-compatible dataset output against the reference runtime. A clean execution exits with code 0. Ordinary errors in the user's program return code 1, while an unsupported feature or interpreter defect returns code 2 with a line number. Scripts and coding agents can use that distinction without trying to interpret a human-readable log.

OpenSAS also compiles to WebAssembly and runs in KIRHA's browser playground. The interpreter, program, and data stay in the page during execution. The playground can generate code from a natural-language description, and the site says only that description is sent to the model used to write it. This local execution pattern matters for regulated data because a runtime can sit inside the same controlled environment as the source files. A coding agent can write a program, execute it, inspect the result, and correct the code without uploading patient-level data to a remote SAS service. Human review and organizational validation are still necessary for regulated production work.

The software is free under the Apache 2.0 license, and its repository accepts contributions backed by tests. There is no paid OpenSAS tier described. The project is young and its language coverage remains deliberately narrower than SAS 9.4, so teams should run representative programs and review the documented grammar before planning a migration. Its value is clearest when the required procedures and formats fall inside the supported clinical programming subset. The public repository, downloadable binaries, explicit unsupported-feature exit code, and reproducible test suites make those boundaries easier to inspect than they would be in a closed interpreter.

Key Features

  • Standalone SAS language interpreter
  • SAS7BDAT and XPT support
  • DATA step and macro language
  • Clinical procedure coverage
  • Browser-based WebAssembly runtime
  • Reference-output conformance tests

Pros & Cons

What we like

  • Runs supported SAS programs without a proprietary runtime
  • Separates programming errors from unsupported interpreter features
  • Keeps browser execution and data on the local page
  • Publishes its source, test corpus, and compatibility boundaries

Room for improvement

  • Supports only a subset of the full SAS 9.4 language
  • Modeling, survival, and graphics procedures are not implemented
  • Prebuilt platform coverage omits some architectures
  • Young project with a small open-source community

Frequently Asked Questions

What is OpenSAS?
OpenSAS is an Apache 2.0 interpreter for a tested subset of the SAS 9.4 language. It runs as a standalone binary on several desktop platforms or as WebAssembly in a browser.
Is OpenSAS fully compatible with SAS 9.4?
No. It supports a substantial clinical programming subset, including the DATA step, macro language, SQL, reporting procedures, and major dataset formats, but it doesn't implement several modeling, survival, and graphics procedures.
How does OpenSAS report unsupported code?
Unsupported features and suspected interpreter bugs exit with code 2 and a line number. Errors in the SAS program use code 1, which gives scripts and agents a simple way to distinguish the two cases.
Is OpenSAS free?
Yes. The interpreter is open source under the Apache 2.0 license, and the project provides source code, release binaries, tests, and a browser playground.

Best For

Running supported clinical SAS pipelines in controlled environmentsTesting SAS code written by a coding agentReading and writing common SAS dataset formatsEvaluating an open runtime for legacy programs

Featured in

Alternatives to OpenSAS

Reviews (0)

No reviews yet

Be the first to share your experience with OpenSAS

Sign in to write a review

Badge builder

Add OpenSAS to your website

Choose a badge style and size, preview it here, then copy the generated HTML. Badge images are self-contained SVGs and do not require an external script.

OpenSAS badge preview
<a href="https://toolindex.net/tools/opensas?ref=badge" target="_blank" rel="noopener">
  <img src="https://toolindex.net/badge/opensas/medium.svg" alt="OpenSAS - Listed on Tool Index" width="180" height="50" />
</a>

How to use the badge

  1. 1. Pick the style, size, and theme that fit your layout.
  2. 2. Copy the generated HTML from the code block.
  3. 3. Paste it into your footer, homepage, or press page.

Standard badge available

The standard listing badge is available now. Score and circle badges are limited to tools currently ranked in the top 10 of a category.

Badge clicks return visitors to this profile with a referral tag so the source remains identifiable.