Module 2 — The Variable View
Question: what turns a grid of numbers into a dataset a stranger could analyze?
Open the sample (Ctrl+Shift+O) and switch to Variable View (Ctrl+2).
Each row describes one variable; work across the columns with the sample's
own examples:
- Name / Label — BMI is the name; "Body mass index (kg/m²)" is the label that output tables print. Names stay short; labels stay readable.
- Type — Age is Numeric; Sex is String. Type decides what the value is; you cannot compute a mean of Strings.
- Value labels — open EducationLevel's value-labels cell: the stored values are the codes 0–3, the labels None/Primary/Secondary/Tertiary. The Data View and all output show the labels; the file stores the codes. This is how surveys are coded in practice.
- Missing values — FastingGlucose_mmolL declares
99as user-missing, labelled "Not measured". A99in the data is a real recorded value — but every analysis excludes it, exactly like a blank. Module 9 is devoted to this. - Measure — Scale (Age), Ordinal (EducationLevel), Nominal (Sex). The measure tells procedures and charts how to treat the variable: you get a mean of a Scale variable, a frequency table of a Nominal one.
Define Variable Properties (Data menu) scans a variable's actual values and offers them for labelling — the fast way to dress a freshly imported column.
Exercise
Use your undressed mystudy.csv import from module 1 (or re-import it):
- Give EducationLevel its four value labels (0=None … 3=Tertiary) — type them in Variable View, or let Data → Define Variable Properties… offer the observed values.
- Declare
99user-missing on FastingGlucose_mmolL and label it "Not measured". - Set EducationLevel's measure to Ordinal.
- Run Analyze → Descriptive Statistics → Frequencies… on EducationLevel before and after step 1. What changed in the output?
- Save as
mystudy.ckd. Now the round trip keeps your work.
The syntax trail
Metadata edits are document edits (they change what is saved, not what is computed), so they do not emit analysis commands — but the Frequencies runs in step 4 did:
frequencies variables=[EducationLevel]
Run it twice from the Syntax tab and compare outputs — same command, richer table once the labels exist.