Skip to main content

sas7bdat.py

This module will read sas7bdat files using pure Python (2.6+, 3+). No SAS software required! The module started out as a port of the R script of the same name found here: <https://github.com/BioStatMatt/sas7bdat> but has since been completely rewritten.

Also included with this library is a simple command line script, sas7bdat_to_csv, which converts sas7bdat files to csv files. It will also print out header information and meta data using the –header option and it will batch convert files as well. Use the –help option for more information.

As is, I’ve successfully tested the script almost three hundred sample files I found on the internet. For the most part, it works well. We can now read compressed files!

I’m sure there are more issues that I haven’t come across yet. Please let me know if you come across a data file that isn’t supported and I’ll see if I can add support for the file.

Usage

To create a sas7bdat object, simply pass the constructor a file path. The object is iterable so you can read the contents like this:

from sas7bdat import SAS7BDAT
with SAS7BDAT('foo.sas7bdat') as f:
    for row in f:
        print row

The values in each row will be a string, float, datetime.date, datetime.datetime, or datetime.time instance.

If you’d like to get a pandas DataFrame, use the to_data_frame method:

df = f.to_data_frame()

Metadata

Release files for sas7bdat 2.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sas7bdat 2.0.4
File Size Uploaded Provenance Actions
sas7bdat-2.0.4.tar.gz 14.5 kB Without provenance Details for sas7bdat-2.0.4.tar.gz

Release files / sas7bdat-2.0.4.tar.gz

Download URL sas7bdat-2.0.4.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
15810552c2157c36e78ce67ac9d6060eaed58084a2b4b089c15286fcc1ad4394
BLAKE2b-256 checksum
How to use checksums
9a8be03d0be24d608f22e16c10fee6e354f8e2bc14f0af4e37a0bf9313ca7132
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for sas7bdat 2.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page