SPSS · Data preparation

Data coding and variable names in SPSS: get it right once so you never have to re-run

A negative Cronbach’s alpha, frequency tables full of unexplained 1s and 2s? Most baffling SPSS errors start at the coding stage. The rules for coding, naming and labelling your variables.

⏱ ~6 min readSources: Pallant 2020 · Field 2018 · IBM 2023Updated:

A negative Cronbach’s alpha. Frequency tables full of 1s, 2s and 3s that nobody can read. A third re-run failing because an income column mixes text and numbers. Most baffling SPSS errors start in one place: coding and declaring your input data. This guide covers how to code each variable type, name variables the way SPSS expects, label them and declare missing values, so you get it right once and never have to re-run.

Four variable types and how to code them: nominal, ordinal, binary and multiple choice, Likert
The four common ways to code survey data.

1Why you have to code your data before analysis

According to Pallant (2020), preparing and cleaning your data is the first and most important step: the quality of your results depends directly on the quality of your input. Survey data usually arrives as text (“Male”, “Agree”), with blanks or invalid answers, but SPSS can only calculate with numbers of the right type.

✅ Proper coding means
  • SPSS recognizes each variable type and can run means, alpha, EFA and regression
  • Fewer entry errors, and odd values, missing data and outliers are easy to spot
  • Readable results thanks to labels, and easy to reproduce when your supervisor checks

2How to code survey data by variable type

According to Field (2018), coding turns answers into numeric values. Each value carries one meaning, used the same way throughout the data.

Nominal variables

No order; the numbers only tell groups apart and say nothing about bigger or smaller.

DepartmentCode
Information technology1
Economics2
Languages3
Tourism4

Ordinal variables

There is an order, though the gaps between levels need not be equal. Codes rise in order, and ranges must not overlap.

Monthly incomeCode
Under $5001
$500 to under $1,0002
$1,000 to under $1,5003
$1,500 to under $2,0004
$2,000 or more5

Binary variables and multiple-response questions

Code binary variables 0/1 or 1/2 (ever bought online: No = 0, Yes = 1). For multiple-response questions, split each option into its own variable (1 = selected, 0 = not selected).

IDSRC_FBSRC_TTSRC_YT
1101
2011

Likert scales

All items in a scale share one convention, rising with agreement. Cronbach’s alpha, EFA, CFA and SmartPLS all depend on this.

ValueMeaning
1Strongly disagree
2Disagree
3Neutral
4Agree
5Strongly agree

3Reverse-coding negatively worded items

A reversed item such as “I find the checkout process tedious” measures the same concept in the opposite direction. Left as is, it correlates negatively with the others, and alpha drops sharply or even goes negative.

Recoding diagram: 1 becomes 5, 2 becomes 4, 3 stays, 4 becomes 2, 5 becomes 1
Reverse-coding a 5-point Likert item into a new variable.
🖱️ Reverse-coding in SPSS
  1. Transform→Recode into Different Variables→Old and New Values
  2. Map 1→5, 2→4, 3→3, 4→2, 5→1.
  3. Give the new variable an _R suffix (say, SAT3_R) so the original stays intact, and use the new one in your analysis.
⚠️ Recode; never edit by hand

Hand-editing cells is slow and easy to get wrong. A recode can also be saved with Paste as syntax, so you can re-run it or show exactly what you did.

4SPSS variable naming rules

According to IBM (2023), variable names must follow these syntax rules:

  • Start with a letter; no spaces
  • No special characters such as % # & / ? ! *
  • No duplicates, and no SPSS keywords (AND, OR, NOT, ALL, BY…)
  • Short, with consistent English abbreviations
AvoidPrefer
Question 1Q1
Your ageAGE
Gender of respondentGENDER
Level of satisfactionSAT
Purchase intentionPI

Name by construct

The construct code + number pattern makes it quick to pick variables for Cronbach’s alpha, EFA, CFA or SmartPLS:

ConstructVariables
Functional ValueFV1, FV2, FV3, FV4
Social ValueSV1, SV2, SV3
Physical RiskPR1, PR2, PR3
Purchase IntentionPI1, PI2, PI3

5Variable labels and value labels

A Variable Label gives the full question; Value Labels say what each code means, so your output shows “Male/Female” instead of “1/2”.

Variable Label

NameLabel
FV1This product provides good value for money
PI1I intend to purchase this product soon

Value Labels

ValueLabel
1 / 2GENDER: Male / Female
1 … 5Likert: Strongly disagree … Strongly agree

6Declaring Missing and Measure in Variable View

Missing

Leave the cell empty (system-missing), or use a code that cannot be a real answer (such as 99) and declare it in the Missing column. Otherwise SPSS treats 99 as a real answer and your means are pulled off.

Measure

  • Nominal: gender, department, occupation
  • Ordinal: income or age in bands
  • Scale: quantitative values; Likert items when computing means or running regression

7Building a codebook, and coding automatically

A codebook records each variable name, its question, the coding table and how missing values are handled. It helps you read results correctly, lets your supervisor check your work quickly, and often goes in the thesis appendix.

If your data comes from Google Forms, The Light Data’s SPSS encoding tool does these steps for you: AI reads the form, proposes valid variable names and a coding table for each question, splits checkbox questions into 0/1 variables, and exports a coded Excel file with a codebook sheet that opens directly in SPSS. You review the whole plan before exporting.

🎯 Remember
  • Code by variable type; Likert rises with agreement; checkboxes split into 0/1 variables.
  • Reverse-code reversed items into a new variable (_R) before running alpha.
  • Short, valid names by construct code; complete Label, Values, Missing and Measure.
  • Keep a codebook. With clean data, your alpha, EFA, regression and SEM can be trusted.

Frequently asked questions

Should Likert coding start at 0 or 1?

The usual convention is 1 to 5 (or 1 to 7), rising with agreement. What matters is using the same coding for every item in a scale and recording it in your codebook.

How do I reverse-code an item in SPSS?

Use Transform → Recode into Different Variables, map 1→5, 2→4, 3→3, 4→2, 5→1 and give the new variable a name such as SAT3_R so the original stays intact.

How do I declare missing values?

Leave the cell empty (system-missing), or use a code that cannot be a real answer, such as 99, and declare it in the Missing column of Variable View so SPSS does not include it in the analysis.

Which Measure should I pick in Variable View?

Nominal for categories (gender, department), Ordinal for ordered bands (income ranges), Scale for quantitative values. Likert items are usually set to Scale when you compute means and run regression.