Case Semantics & Transforms
Two related ideas: case semantics change which cases an analysis sees and how much each counts, and transforms create or reshape variables. Both live under the Data and Transform menus, and both are respected by every analysis automatically.
Case semantics (Data menu)
These three settings travel with every analysis, chart and transform you run. The status bar shows when any of them is active.
Select Cases
Data → Select Cases… (Ctrl+Alt+S). Restrict the analysis to a subset of
cases — for example, only participants where Age >= 60, or a random sample.
Unselected cases are filtered out of every subsequent statistic until you clear
the selection. You can choose to filter (hide) or to mark unselected cases.
Weight Cases
Data → Weight Cases… (Ctrl+Alt+W). Give each case a frequency weight
from a variable, so a case with weight 3 counts as three observations. Used for
data stored as a frequency table, or to apply survey weights. Counts, means and
tests all honour the weight.
Split File
Data → Split File… (Ctrl+Alt+T). Repeat every analysis separately for
each group of a categorical variable — e.g. run all your descriptives once per
StudyZone. Output is produced per split group until you turn the split off.
Order of operations. Select narrows the cases, Weight scales their counts, and Split partitions the result into groups — and every analysis you run sees all three at once.
Transforms (Transform & Data menus)
Compute Variable
Transform → Compute Variable… (Ctrl+Shift+C). Create a new variable (or
overwrite one) from an expression. The expression language is missing-aware
and typed (number, string or date):
- Arithmetic —
+ - * /, parentheses,MOD. - Numeric functions —
SQRT,LN,LOG10,EXP,ABS,MIN,MAX, the trig family,ROUND(x[, digits]), and theSD/VARIANCEaggregates. - Logic — comparisons (
< <= > >= = ~=),AND OR NOT, andIF(cond, then, else). - String —
CONCAT,LENGTH,UPCASE,LOWCASE,LTRIM,RTRIM,SUBSTR,INDEX,REPLACE,STRING,NUMBER, and quoted literals. - Date (ISO
YYYY-MM-DD) —DATE.DMY,DATE.MDY,YEAR,MONTH,DAY,DATEDIFF.
The new variable takes the type of its expression — a string expression makes a string variable, a date expression a date variable.
Example. BMI_category = IF(BMI >= 30, "Obese", IF(BMI >= 25, "Overweight", "Normal")).
Recode
Transform → Recode… (Ctrl+Shift+R). Map a variable's values into new ones —
into the same variable or a new one. Use it to collapse categories (e.g. five
education levels into three) or to band a scale variable.
Grouping a scale variable vs. histogram bins
Two things look alike but do different jobs:
- The histogram's bins slider groups a scale variable in the picture only — display, no data change. Use it to explore shape.
- A Recode into Different Variables (or Bin Variable, below, for the common numeric-cutpoints case) makes a real categorical variable (BMI → Underweight/Normal/Overweight/Obese) that crosstabs, boxplots and ANOVA can use, and that is saved with the document. Use it when the groups are part of the analysis.
The tutorial workbook's transforms module walks this exact recode end to end.
Rank Cases
Transform → Rank Cases… (Ctrl+Shift+K). Create a new variable holding each
case's rank on a chosen variable, with the usual tie-handling options.
Bin Variable
Transform → Bin Variable… (Ctrl+Shift+N). The purpose-built front end for
grouping a scale variable into a new ordinal one — Recode works for this too,
but means typing every cutpoint and label by hand. Pick a variable and a
method:
- Equal width — N groups of equal size along the value range (e.g. four 10-point-wide BMI bands).
- Equal count (quantiles) — N groups with (about) the same number of cases in each, e.g. splitting into quartiles.
- Custom — your own ascending cutpoints (e.g.
18.5, 25, 30for the standard BMI categories).
A live preview shows the resolved boundaries as cut lines over a histogram of
the variable, and the generated group labels (< 18.5, 18.5 – 25, …), before
you commit. The new variable is numeric with Ordinal measure and value labels
already set — nothing left to finish in Variable View. Cutpoints are resolved
against the currently active Select Cases/Weight Cases, like every analysis.
Reshaping the dataset (Data menu)
- Sort Cases (
Ctrl+Shift+D) — reorder rows by one or more variables. - Transpose (
Ctrl+Alt+P) — swap rows and columns. - Merge Files (
Ctrl+Alt+M) — add cases or add variables from another dataset, matched by a key. - Define Variable Properties (
Ctrl+Alt+D), Bulk Rename and Variable Sets — covered in Working with Data.
Reproducibility note
Compute, Rank, Sort and Bin Variable are journalled — they appear in the
Syntax console as commands, so a data-preparation
pipeline can be saved and replayed on fresh data exactly. Bin Variable's
journaled command always records the resolved cutpoints, even for the
Equal width/Equal count methods — so replaying it later reproduces the same
groups rather than silently re-deriving different ones from changed data.
Recode is the deliberate exception: its ordered rule list does not reduce to a
one-line command, so it stays a dialog transform — the recoded variable itself
is preserved by saving the .ckd.