Formats
Five output format engines fed by a single canonical export model — CSV, SPSS pair (`.sps` + `.dat`), `.sav` binary, XLSX workbook, and fixed-width ASCII. Same tri-state semantics, same column contract, same long companions — different physical envelopes for different downstream pipelines.
One model, five engines
Every export format reads from one canonical model — the same tri-state cell values, the same column naming, the same loop suffixes, the same long companions, the same SPSS labels. What differs is how the model is serialised on the way out.
| Format | Endpoint suffix | Wrapper | Best for |
|---|---|---|---|
| CSV | ?format=csv | Single file (or ZIP if long companions requested) | Portable, Excel-openable, pandas / R defaults, quick handoffs |
| SPSS pair | ?format=spss | ZIP of .sps + .dat (+ any long companions) | The MR industry standard — hand-edited syntax pipelines |
.sav binary | ?format=sav | Single .sav (or ZIP with long companions) | SPSS-first analysts, pyreadstat / haven readers |
| XLSX | ?format=xlsx | Single workbook with wide + codebook + long companions as separate sheets | Stakeholder handoffs, quick inspection, non-technical reviewers |
| ASCII (fixed-width) | ?format=ascii | ZIP of .dat + codebook.txt (+ any long companions) | Legacy Quantum tabulation, custom fixed-width pipelines |
The endpoint is uniform: GET /api/surveys/:sid/export?format=<fmt>. See Data Hub → Endpoints.
CSV
Wide format, no metadata, comma-separated. UTF-8 with a BOM (so Excel auto-detects encoding).
Shape. One row per respondent; one column per variable; the value labels live in the column headers and in the paired codebook.csv (if requested).
Long companions. When the export includes CBC / MaxDiff long files or a ?long=<loopId>-stacked loop, the response becomes a ZIP with wide.csv + one CSV per companion. A wide-only request is a single CSV.
Nulls. Empty cells (1,,0, — blank between commas). Analysts filter with IS NULL or the equivalent in their tool.
Best fit: ad-hoc analysis, downstream pandas / R / SQL pipelines, sharing with a client who wants to open the file in Excel.
SPSS pair — .sps + .dat
Two files, always shipped as a ZIP:
.dat— fixed-width data. No metadata inside; readable but unhelpful alone..sps— SPSS syntax file that reads the.datand applies all metadata (variable labels, value labels, measurement level, missing values).
Run the .sps in SPSS proper and it loads the data + attaches every label — that’s the analyst’s first-touch workflow.
Analyst-editable. The .sps is plain text. Analysts routinely hand-tweak it before running (add missing-value declarations, rename variables, alias verbose labels). That editability is why the industry standardised on the pair rather than shipping .sav only.
Long companions. CBC / MaxDiff long files and stacked loops ship as additional .sps + .dat pairs in the same ZIP.
Best fit: the MR industry default. If your analyst says “send me an SPSS export”, this is what they mean.
.sav — SPSS binary
Single file. All metadata baked in — variable labels, value labels, measurement level, missing values — using the true SPSS binary format (not a re-encoded CSV).
Read with SPSS proper, pyreadstat.read_sav(...) in Python, haven::read_sav(...) in R.
Long companions. When companions are present, the response is a ZIP with the primary .sav + one .sav per companion.
PSPP-verified. Every .sav release is round-tripped through PSPP (the GNU SPSS runtime) in the build pipeline. That check caught a fixed-width truncation bug that pyreadstat alone missed — so if a variable opens in SPSS proper with data cut off, that’s the class of regression the PSPP gate exists to catch.
Best fit: SPSS-first shops who don’t need the intermediate .sps step, or pipelines with pyreadstat / haven upstream.
XLSX
Single workbook with multiple sheets:
data— the wide file (one row per respondent).codebook— the variable-label / value-label / measure map, one row per variable.cbc_long,maxdiff_long,loop_long_<id>— one sheet per long companion.cbc_design— the design legend, when a CBC exists.
Best fit: stakeholder handoffs, ad-hoc review, situations where the recipient will open the file in Excel and want everything in one artefact.
data_1, data_2, … or the export may refuse — reach for CSV or SPSS instead.ASCII (fixed-width)
Two files in a ZIP:
.dat— fixed-width data, one row per respondent. Every field has a declared width.codebook.txt— the column-to-width map, value labels, and missing-value declarations, in the standard ASCII codebook convention.
Best fit: legacy Quantum pipelines, custom tabulation engines, situations where the downstream tool reads fixed-width ASCII natively.
recordWidth — the Quantum-column indicator
The Quantum tabulation tradition treats records at 80-column or 160-column widths. Modern surveys often exceed both. The GET /api/surveys/:sid/export/summary endpoint returns recordWidth — the fixed-width record length in columns — so a tabulation pipeline can preallocate correctly (or a survey author can see they’re about to trip the tool’s limit).
openEndsUnbounded
Free-text open ends have no reserved width — the export grows the field to observed content. /export/summary returns openEndsUnbounded (the count of such fields). Downstream Quantum jobs that expected fixed widths need to handle this — usually by truncating open ends to a project convention (200 chars) or shipping them in a separate delimited file.
The universal contract
Regardless of format:
- Same variable set — column count is a function of the survey’s authored domain, not the format.
- Same
nullsemantics —nullin tri-state projection renders as blank / system-missing / declared-missing per the format’s convention, but always means the same thing. - Same long companions — CBC / MaxDiff long files ship in every format;
?long=<loopId>stacking works in every format. - Same status codes — the disposition column (complete / terminated / quotafull / …) uses the same standardised codes across all five formats (
server/export/status-codes.js). - Same
recordcase number — the leadingrecordcolumn (persisted serial per respondent) is present in every format. - Same data-edits overlay — if an analyst has made corrections via Data Hub, the corrected values ship in every format (see Data Hub → Data View).
Switch formats freely; the semantics ride along.
Picking a format
| Question | Answer |
|---|---|
| Analyst asked for “SPSS” without more detail | SPSS pair — that’s the MR default |
| Analyst opens files in Python / R | .sav or CSV, whichever they prefer |
| Client wants to open in Excel | XLSX or CSV |
| Downstream tool is Quantum or custom fixed-width | ASCII |
| Quick ad-hoc check of the raw data | CSV |
| Handoff to a non-technical stakeholder | XLSX (codebook sheet included) |
Formats aren’t hard commitments — regenerate a different one from the same source data at any time via the Data Hub or endpoints.
See also
- Data Hub — the UI + endpoints that produce each format
- Column naming — the shared variable-name rule
- SPSS labels — variable / value labels and measurement level (used by
.sps/.sav/ XLSX codebook) - Long format — companion files that ship alongside the wide
- Tri-state projection — how
nullrenders in each format