{"id":20880777,"url":"https://github.com/curtisalexander/readstat-rs","last_synced_at":"2026-05-12T00:02:06.148Z","repository":{"id":39993067,"uuid":"309402744","full_name":"curtisalexander/readstat-rs","owner":"curtisalexander","description":":floppy_disk: Toolkit for SAS binary files; :crab: Rust integration with ReadStat C library","archived":false,"fork":false,"pushed_at":"2026-05-11T20:57:38.000Z","size":17593,"stargazers_count":28,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-11T21:38:32.330Z","etag":null,"topics":["cli","readstat","rust","rust-ffi","sas","sas7bdat","wasm"],"latest_commit_sha":null,"homepage":"https://curtisalexander.github.io/readstat-rs/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/curtisalexander.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2020-11-02T14:54:46.000Z","updated_at":"2026-05-11T20:56:34.000Z","dependencies_parsed_at":"2023-10-14T06:43:43.914Z","dependency_job_id":"79baea01-01e1-475f-a3b1-583d29eb8b94","html_url":"https://github.com/curtisalexander/readstat-rs","commit_stats":null,"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"purl":"pkg:github/curtisalexander/readstat-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curtisalexander%2Freadstat-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curtisalexander%2Freadstat-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curtisalexander%2Freadstat-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curtisalexander%2Freadstat-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/curtisalexander","download_url":"https://codeload.github.com/curtisalexander/readstat-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curtisalexander%2Freadstat-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32917885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-11T17:09:15.040Z","status":"ssl_error","status_checked_at":"2026-05-11T17:08:45.420Z","response_time":120,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","readstat","rust","rust-ffi","sas","sas7bdat","wasm"],"created_at":"2024-11-18T07:22:04.924Z","updated_at":"2026-05-12T00:02:06.142Z","avatar_url":"https://github.com/curtisalexander.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![readstat-rs](https://github.com/curtisalexander/readstat-rs/workflows/readstat-rs/badge.svg)](https://github.com/curtisalexander/readstat-rs/actions)\n[![Crates.io](https://img.shields.io/crates/v/readstat)](https://crates.io/crates/readstat)\n[![docs.rs](https://img.shields.io/docsrs/readstat)](https://docs.rs/readstat)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\n# readstat-rs\nRead, inspect, and convert SAS binary (`.sas7bdat`) files \u0026mdash; from [Rust code](crates/readstat/), the [command line](crates/readstat-cli/), or the [browser](crates/readstat-wasm/). Converts to CSV, Parquet, Feather, and NDJSON using Apache Arrow.\n\n\u003e The original use case was a command-line tool for converting SAS files, but the project has since expanded into a workspace of crates that can be used as a Rust library, a CLI, or compiled to WebAssembly for browser and JavaScript runtimes.\n\n## :key: Dependencies\nThe command-line tool is developed in Rust and is only possible due to the following _**excellent**_ projects:\n- The [ReadStat](https://github.com/WizardMac/ReadStat) C library developed by [Evan Miller](https://www.evanmiller.org)\n- The [arrow](https://github.com/apache/arrow-rs) Rust crate developed by the Apache Arrow community\n\nThe `ReadStat` library is used to parse and read `sas7bdat` files, and the `arrow` crate is used to convert the read `sas7bdat` data into the [Arrow](https://arrow.apache.org/) memory format. Once in the `Arrow` memory format, the data can be written to other file formats.\n\n\u003e :bulb: **Note:** The ReadStat C library supports SAS, SPSS, and Stata file formats. The [`readstat-sys`](crates/readstat-sys/) crate exposes the **full** ReadStat API \u0026mdash; all 125 functions across all formats. However, the higher-level crates (`readstat`, `readstat-cli`, `readstat-wasm`, `readstat-tests`) currently only implement support for **SAS `.sas7bdat` files**.\n\n## :rocket: CLI Quickstart\n\nConvert the first 50,000 rows of `example.sas7bdat` (by performing the read in parallel) to the file `example.parquet`, overwriting the file if it already exists.\n```sh\nreadstat data /some/dir/to/example.sas7bdat --output /some/dir/to/example.parquet --format parquet --rows 50000 --overwrite --parallel\n```\n\n## :package: CLI Install\n\n### From Cargo\nIf you have Rust installed, the easiest way to install is via `cargo`:\n\n```sh\ncargo install readstat-cli\n```\n\n### Download a Release\n\\[Mostly\\] static binaries for Linux, macOS, and Windows may be found at the [Releases page](https://github.com/curtisalexander/readstat-rs/releases/).\n\n### Setup\nMove the `readstat` binary to a known directory and add the binary to the user's [PATH](https://en.wikipedia.org/wiki/PATH_(variable)).\n\n#### Linux \u0026 macOS\nEnsure the path to `readstat` is added to the appropriate shell configuration file.\n\n#### Windows\nFor Windows users, path configuration may be found within the Environment Variables menu.  Executing the following from the command line opens the Environment Variables menu for the current user.\n\n```sh\nrundll32.exe sysdm.cpl,EditEnvironmentVariables\n```\n\nAlternatively, update the user-level `PATH` in PowerShell (replace `C:\\path\\to\\readstat` with the actual directory):\n\n```powershell\n$currentPath = [Environment]::GetEnvironmentVariable(\"Path\", \"User\")\n[Environment]::SetEnvironmentVariable(\"Path\", \"$currentPath;C:\\path\\to\\readstat\", \"User\")\n```\n\nAfter running the above, restart your terminal for the change to take effect.\n\n### Run\nRun the binary.\n\n```sh\nreadstat --help\n```\n\n## :gear: CLI Usage\n\nThe binary is invoked using subcommands:\n- `metadata` \u0026rarr; writes file and variable metadata to standard out or JSON\n- `preview` \u0026rarr; writes the first N rows of parsed data as `csv` to standard out\n- `data` \u0026rarr; writes parsed data in `csv`, `feather`, `ndjson`, or `parquet` format to a file\n\nColumn metadata \u0026mdash; labels, SAS format strings, and storage widths \u0026mdash; is preserved in Parquet and Feather output as Arrow field metadata. See **[docs/TECHNICAL.md](docs/TECHNICAL.md#column-metadata-in-arrow-and-parquet)** for details.\n\nFor the full CLI reference \u0026mdash; including column selection, parallelism, memory considerations, SQL queries, reader modes, and debug options \u0026mdash; see **[docs/USAGE.md](docs/USAGE.md)**.\n\nFor library, API server, and WebAssembly usage, see **[Examples](#bulb-examples)** below.\n\n## :hammer_and_wrench: Build from Source\n\nClone the repository (with submodules), install platform-specific developer tools, and run `cargo build`. Platform-specific instructions for Linux, macOS, and Windows are in **[docs/BUILDING.md](docs/BUILDING.md)**.\n\n## :computer: [Platform Support](https://doc.rust-lang.org/rustc/platform-support.html)\n\n| Platform | Status | C library | Notes |\n|----------|--------|-----------|-------|\n| **Linux** ([glibc](https://www.gnu.org/software/libc/)) | :heavy_check_mark: Builds and runs | System iconv, system zlib | \u0026mdash; |\n| **Linux** ([musl](https://www.musl-libc.org/)) | :heavy_check_mark: Builds and runs | System iconv, system zlib | \u0026mdash; |\n| **macOS** | :heavy_check_mark: Builds and runs | System `libiconv`, system zlib | \u0026mdash; |\n| **Windows** (MSVC) | :heavy_check_mark: Builds and runs | Vendored iconv, vendored zlib | [Requires `libclang`](docs/BUILDING.md#windows) for [bindgen](https://rust-lang.github.io/rust-bindgen/requirements.html#clang). MSVC supported since [ReadStat](https://github.com/WizardMac/ReadStat) `1.1.5` (no msys2 needed). |\n\n## :books: Documentation\n\n:notebook: **[Online Book (GitHub Pages)](https://curtisalexander.github.io/readstat-rs/)** — full reference including installation, CLI usage, architecture, technical details, and memory safety.\n\n| Document | Description |\n|----------|-------------|\n| [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | Crate layout, key types, and architectural patterns |\n| [docs/USAGE.md](docs/USAGE.md) | Full CLI reference and examples |\n| [docs/BUILDING.md](docs/BUILDING.md) | Clone, build, and linking details per platform |\n| [docs/TECHNICAL.md](docs/TECHNICAL.md) | Floating-point precision and date/time handling |\n| [docs/TESTING.md](docs/TESTING.md) | Running tests, dataset table, fuzz testing, valgrind |\n| [docs/BENCHMARKING.md](docs/BENCHMARKING.md) | Criterion benchmarks, hyperfine, and profiling |\n| [docs/CI-CD.md](docs/CI-CD.md) | GitHub Actions triggers and artifacts |\n| [docs/MEMORY-SAFETY.md](docs/MEMORY-SAFETY.md) | Automated memory-safety CI checks (Valgrind, ASan, Miri, unsafe audit) |\n| [docs/RELEASING.md](docs/RELEASING.md) | Step-by-step guide for publishing crates to crates.io |\n| [scripts/check-updates.sh](scripts/check-updates.sh) | Dependency update checker with supply chain quarantine (`--apply` to update) |\n\n## :jigsaw: Workspace Crates\n\n| Crate | Path | Description |\n|-------|------|-------------|\n| [`readstat`](crates/readstat/) | `crates/readstat/` | Pure library for parsing SAS files into Arrow RecordBatch format. Output writers are feature-gated. |\n| [`readstat-cli`](crates/readstat-cli/) | `crates/readstat-cli/` | Binary crate producing the `readstat` CLI tool (arg parsing, progress bars, orchestration). |\n| [`readstat-sys`](crates/readstat-sys/) | `crates/readstat-sys/` | Raw FFI bindings to the full ReadStat C library (SAS, SPSS, Stata) via bindgen. |\n| [`readstat-iconv-sys`](crates/readstat-iconv-sys/) | `crates/readstat-iconv-sys/` | Windows-only FFI bindings to libiconv for character encoding conversion. |\n| [`readstat-tests`](crates/readstat-tests/) | `crates/readstat-tests/` | Integration test suite (29 modules, 14 datasets). |\n| [`readstat-wasm`](crates/readstat-wasm/) | `crates/readstat-wasm/` | WebAssembly build for browser/JS usage (excluded from workspace, built with Emscripten). |\n\nFor full architectural details, see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).\n\n## :bulb: Examples\n\nThe [`examples/`](examples/) directory contains runnable demos showing different ways to use readstat-rs.\n\n| Example | Description |\n|---------|-------------|\n| [`cli-demo`](examples/cli-demo/) | Convert a `.sas7bdat` file to CSV, NDJSON, Parquet, and Feather using the `readstat` CLI |\n| [`api-demo`](examples/api-demo/) | API servers in [Rust](examples/api-demo/rust-server/) (Axum) and [Python](examples/api-demo/python-server/) (FastAPI + PyO3) — upload, inspect, and convert SAS files over HTTP |\n| [`bun-demo`](examples/bun-demo/) | Parse a `.sas7bdat` file from JavaScript using the WebAssembly build with Bun |\n| [`web-demo`](examples/web-demo/) | Browser-based viewer and converter — upload, preview, and export entirely client-side via WASM |\n| [`sql-explorer`](examples/sql-explorer/) | Browser-based SQL explorer — upload a `.sas7bdat` file and query it interactively with SQL via AlaSQL |\n\nTo use `readstat` as a library in your own Rust project, add the [`readstat`](crates/readstat/) crate as a dependency.\n\n## :link: Resources\nThe following have been **_incredibly_** helpful while developing!\n- [How to not RiiR](http://adventures.michaelfbryan.com/posts/how-not-to-riir/#building-chmlib-sys)\n- [Making a *-sys crate](https://kornel.ski/rust-sys-crate)\n- [Rust Closures in FFI](https://adventures.michaelfbryan.com/posts/rust-closures-in-ffi/)\n- Rust FFI: Microsoft Flight Simulator SDK\n    - [Part 1](https://youtu.be/jNNz4h3iIlw)\n    - [Part 2](https://youtu.be/ugiR9M16fwg)\n- Stack Overflow answers by [Jake Goulding](https://stackoverflow.com/users/155423/shepmaster)\n- ReadStat pull request to add [MSVC/Windows support](https://github.com/WizardMac/ReadStat/pull/214)\n- [jamovi-readstat](https://github.com/jamovi/jamovi-readstat) [appveyor.yml](https://github.com/jamovi/jamovi-readstat/blob/master/appveyor.yml) file to build ReadStat on Windows\n- [Arrow documentation for utilizing ArrayBuilders](https://docs.rs/arrow/latest/arrow/array/trait.ArrayBuilder.html#example)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurtisalexander%2Freadstat-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurtisalexander%2Freadstat-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurtisalexander%2Freadstat-rs/lists"}