Skip to content

SAS7BDAT (.sas7bdat)

.sas7bdat file signature | application/x-sas-data

SAS7BDAT is a binary data set file format created and maintained by SAS Institute for storing structured datasets. It is used primarily by SAS software for statistical analysis, data management, reporting, and interchange between SAS and compatible analytical tools. The format is generally safe, though files from untrusted sources should be handled with standard caution because they may contain large or malformed data structures; it remains a long-standing, proprietary SAS format.

Safe

Magic Bytes

Offset 84
53 41 53 20 46 49 4C 45

Sources: Apache Tika

Extension

.sas7bdat

MIME Type

application/x-sas-data

Byte Offset

84

Risk Level

Safe

Validation Code

How to validate .sas7bdat files in Python

Python
def is_sas7bdat(file_path: str) -> bool:
    """Check if file is a valid SAS7BDAT by magic bytes at offset 84."""
    signature = bytes([0x53, 0x41, 0x53, 0x20, 0x46, 0x49, 0x4C, 0x45])
    with open(file_path, "rb") as f:
        f.seek(84)
        return f.read(8) == signature

How to validate .sas7bdat files in Node.js

Node.js
function isSAS7BDAT(buffer: Buffer): boolean {
  const signature = Buffer.from([0x53, 0x41, 0x53, 0x20, 0x46, 0x49, 0x4C, 0x45]);
  if (buffer.length < 92) return false;
  return buffer.subarray(84, 92).equals(signature);
}

How to validate .sas7bdat files in Go

Go
func IsSAS7BDAT(data []byte) bool {
    signature := []byte{0x53, 0x41, 0x53, 0x20, 0x46, 0x49, 0x4C, 0x45}
    if len(data) < 92 {
        return false
    }
    return bytes.Equal(data[84:92], signature)
}

API Endpoint

GET /api/v1/sas7bdat
curl https://filesignature.org/api/v1/sas7bdat

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .sas7bdat file?

A .sas7bdat file is identified by the magic bytes 53 41 53 20 46 49 4C 45 at byte offset 84. SAS7BDAT is a binary data set file format created and maintained by SAS Institute for storing structured datasets. It is used primarily by SAS software for statistical analysis, data management, reporting, and interchange between SAS and compatible analytical tools. The format is generally safe, though files from untrusted sources should be handled with standard caution because they may contain large or malformed data structures; it remains a long-standing, proprietary SAS format.

What are the magic bytes for .sas7bdat files?

The magic bytes for SAS7BDAT files are 53 41 53 20 46 49 4C 45 at byte offset 84. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .sas7bdat file?

To validate a .sas7bdat file, read the first bytes of the file and compare them against the known magic bytes (53 41 53 20 46 49 4C 45) at offset 84. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .sas7bdat files?

The primary MIME type for .sas7bdat files is application/x-sas-data.

Is it safe to open .sas7bdat files?

SAS7BDAT (.sas7bdat) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.