Export & data

SPSS labels

Variable labels, value labels, and measurement level — the metadata that turns a raw punch file into a codebook. What each question type projects, how `measure:` overrides the default, and how the `.sps` / `.dat` / `.sav` engines encode it. Grounded in what SPSS Custom Tables actually branches on, not aspirational spec.

What SPSS carries beyond the data

An SPSS export isn’t just a punch file — it’s paired with a codebook that tells SPSS (or R via pyreadstat, Python via savReaderWriter, most stats tooling) what each variable is. Three pieces of metadata per variable:

MetadatumWhat it isWhere it comes from
Variable labelHuman-readable name for the variableThe question’s text: (truncated to a display-friendly length)
Value labelsCode → label map for each valid valueThe question’s options: (or scale: for grid types)
Measurement levelnominal / ordinal / scaleQuestion type (see below), optionally overridden per question with measure:

The same metadata ships in every format — .sav binaries have it baked in, .sps + .dat pairs declare it in the syntax file, XLSX includes a codebook sheet, and CSV ships a companion codebook.csv when requested.

Variable labels

The question’s text: becomes the variable label. For row / column / option fanned-out variables, the label composes the parent question’s text with the row / column / option label:

QSatisf         "How satisfied are you with each of these?"
QSatisfr1       "How satisfied are you with each of these? — Support"
QSatisfr2       "How satisfied are you with each of these? — Documentation"
QUsageo1        "Which of these apply? — Weekly"
QVehicleModel   "Model" (from the cascading step label)

The join character (—) and truncation are the codebook engine’s convention, not something an author controls per-question.

Value labels

For coded types, options: gives the codebook the code → label mapping:

- qid: QBrand
    type: single
    options:
        1: Apple
        2: Samsung
        3: Sony

exports as:

QBrand = 2 → the codebook maps 2 → "Samsung"

For grid types, scale: fills the same role:

- qid: QSatisf
    type: gridSingle
    scale:
        1: Very dissatisfied
        2: Dissatisfied
        3: Neutral
        4: Satisfied
        5: Very satisfied

QSatisfr1 = 4 → codebook says 4 → "Satisfied" for every row column.

For multi / gridMulti (tri-state fan-out — see Tri-state projection), the per-code column carries a 0 / 1 / null value; the value label typically maps 1 → "Selected", 0 → "Not selected" — but the option’s own label lives in the variable label, so the code doesn’t need to.

Measurement level

SPSS attaches a measurement level to every variable. It’s advisory, not enforced — SPSS won’t refuse to run a mean on a nominal — but the workhorse procedures branch on it:

LevelMeaningLegal operations
nominalUnordered categoriescounts, mode
ordinalOrdered categories, unequal spacing+ median, monotone comparisons
scaleInterval / ratio, equal spacing+ mean, sd, regression

Where it actively matters in practice:

  • Custom Tables (CTABLES). The big one in market research: scale variables auto-produce means / summary stats; nominal / ordinal produce counts / percentages.
  • Chart Builder filters offered chart types and warns on mismatch.
  • Automated modelling (Automatic Linear Modeling, TwoStep Cluster, trees) auto-assigns scale → covariate, nominal / ordinal → factor.

Frequencies / Descriptives / Means / Crosstabs / Regression / T-test / ANOVA don’t enforce it — but correct levels save an MR analyst setup time. Wrong ones are flippable in Variable View in seconds.

The default rule — semantic, per question type

Question typeDefault measureRationale
single, multi, lookupnominalCategorical, no meaningful order between codes.
rank, gridSingle, gridMultiordinalThe scale is ordered (rank position, Likert).
number, numberList (rows), gridNumber (cells)scaleReal numbers — mean / regression are meaningful.
opennominalFree text; no ordering.
CBC / MaxDiff long companion metric columnsPer-column defaults — see Long formatDesign-file joins carry their own convention.

Overriding per question

Any question can override with measure::

- qid: QAgeGroup
    type: single
    text: Age bracket
    measure: ordinal      # override — the codes are age-ordered
    options:
        1: 18-24
        2: 25-34
        3: 35-44
        4: 45-54
        5: 55+

Valid values: nominal / ordinal / scale. The override applies to every fan-out column that inherits from this question (all of QAgeGroup’s option columns, all of a grid’s row columns).

When to override. Most defaults are right. Reach for measure: when an ordered single masquerades as categorical (age brackets, income bands, education levels), when a number is actually a category code you don't want SPSS averaging (postal code stored as integer), or when a Likert scale for a project needs to be treated as interval rather than ordinal.

The alternative — storage-type-driven

One common industry rule assigns measure purely by storage type: numeric → ordinal, string → nominal, date → unknown — never scale. Simple to implement, and it’s what many MR pipelines have shipped for decades.

Fieldbase takes a different line: the default is semantic (assigned per question type — see the table above) and per-variable overridable via measure:. Closer to what an author would set by hand in SPSS’s Variable View. A file imported from a storage-type-driven pipeline will look “flatter” (everything ordinal or nominal, no scale variables) than one exported directly from Fieldbase.

The three SPSS formats

.sav — SPSS binary

Single file, all metadata baked in. Open directly in SPSS; read from Python with pyreadstat.read_sav(...) / R with haven::read_sav(...). The most portable of the three when the reader supports it.

Fieldbase writes true SPSS-binary .sav (not a re-encoded CSV) — value labels, variable labels, and measurement level are preserved.

.sps + .dat — the classic SPSS pair

Two files:

  • .dat — fixed-width data, no metadata.
  • .sps — SPSS syntax file: DATA LIST FILE= at the top, then VARIABLE LABELS, VALUE LABELS, VARIABLE LEVEL, MISSING VALUES.

Run the .sps in SPSS and it loads the .dat and applies all metadata. This is the shape most market-research pipelines have expected for decades.

Editable in any text editor. Analysts commonly hand-tweak the syntax (add missing-value declarations, rename variables) before running.

ASCII (fixed-width)

.dat + a codebook.txt. No SPSS syntax — for pipelines that read fixed-width ASCII natively (legacy Quantum, custom tabulation engines). See Formats for the width contract and the recordWidth indicator.

Missing values

Unanswered scalar questions and null cells from tri-state projection render as system-missing in .sav and .sps — the standard SPSS convention (. in Variable View, blank in the data file). Analysts filter with SYSMIS(varname).

Author-declared missing codes (e.g. an isolate option “I don’t know” carrying code 99) can be declared with missing: — the codebook engine emits MISSING VALUES <var> (99). in the .sps and marks 99 as user-missing in the .sav.

PSPP verification

The .sav and .sps outputs are load-tested against the real SPSS engine — PSPP (the GNU-licensed SPSS runtime) is built into the release pipeline and every export format is round-tripped through it. That check caught a fixed-width truncation bug that pyreadstat alone missed. If your analyst opens the .sav in SPSS proper and sees a variable’s data cut off at the field width, that’s the class of bug the PSPP gate exists to catch — file it as a regression.

See also

  • Formats — CSV / SPSS pair / .sav / XLSX / ASCII — when to pick each
  • Column naming — the variable name that the label is attached to
  • Tri-state projection — where system-missing comes from
  • Data Hub — the UI + endpoints to generate any of these formats