SPSS Format
Description
SPSS (Statistical Package for the Social Sciences) files are binary data files used by SPSS software for statistical analysis. The .sav format is SPSS's native data file format. This implementation supports reading SPSS files and converting them to Python dictionaries.
File Extensions
.sav- SPSS data files.spss- SPSS files (alias)
Implementation Details
Reading
The SPSS implementation:
- Uses
pyreadstatlibrary for reading - Reads SPSS files and converts to pandas DataFrame, then to dictionaries
- Supports metadata extraction (variable labels, value labels)
- Requires file path (not stream)
Writing
Writing is not currently supported for SPSS format.
Key Features
- Statistical format: Designed for statistical analysis
- Metadata support: Can extract variable labels and value labels
- Totals support: Can count total rows
- Type preservation: Maintains data types from SPSS
Usage
from iterable import open_iterable
# Basic reading
source = open_iterable('data.sav')
for row in source:
print(row)
source.close()
Parameters
No specific parameters required.
Limitations
- Read-only: SPSS format does not support writing
- pyreadstat dependency: Requires
pyreadstatpackage - File path required: Requires filename, not stream
- Flat data only: Only supports tabular data
- Memory usage: Entire file is loaded into memory
Compression Support
SPSS files can be compressed with all supported codecs:
- GZip (
.sav.gz) - BZip2 (
.sav.bz2) - LZMA (
.sav.xz) - LZ4 (
.sav.lz4) - ZIP (
.sav.zip) - Brotli (
.sav.br) - ZStandard (
.sav.zst)
Use Cases
- Statistical analysis: Working with SPSS data files
- Data migration: Converting SPSS data to other formats
- Research data: Processing research datasets in SPSS format
- Social sciences: Common in social science research