SD2
application/x-sas-data-v6
Magic Bytes
Offset: 0
53 41 53 20 20 20 20 20 36 2E
SAS Data (SD2) is a proprietary data storage format developed and maintained by the SAS Institute for its statistical analysis software suite. These files store structured datasets, including numerical variables, character strings, and metadata, primarily used for data management and statistical modeling tasks. As a legacy format associated with SAS version 6, SD2 files are now largely superseded by the modern sas7bdat format but remain accessible through specialized drivers for historical data retrieval.
Validation Code
How to validate .sd2 files in Python
Python
def is_sd2(file_path: str) -> bool:
"""Check if file is a valid SD2 by magic bytes."""
signature = bytes([0x53, 0x41, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x36, 0x2E])
with open(file_path, "rb") as f:
return f.read(10) == signature
How to validate .sd2 files in Node.js
Node.js
function isSD2(buffer: Buffer): boolean {
const signature = Buffer.from([0x53, 0x41, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x36, 0x2E]);
return buffer.subarray(0, 10).equals(signature);
}
Go
func IsSD2(data []byte) bool {
signature := []byte{0x53, 0x41, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x36, 0x2E}
if len(data) < 10 {
return false
}
return bytes.Equal(data[:10], signature)
}
API Endpoint
GET
/api/v1/sd2
curl https://filesignature.org/api/v1/sd2