Unit 13 · Dissertation toolkit
SPSS syntax for beginners
Use the Paste button and the SPSS Syntax Editor to write, run, comment and save .sps files so your analysis is reproducible.
Quick answer: How do you use SPSS syntax?
- In any dialog, click Paste instead of OK to write the syntax.
- Every command ends with a full stop.
- Select the lines and choose Run › Selection (Ctrl+R).
- Save the file as .sps next to your data.
Why use SPSS syntax?
Syntax is SPSS’s command language. Every dialog writes syntax behind the scenes, and the Paste button shows it to you. Saving your syntax gives a complete, rerunnable record of everything you did to your data.
When to use it
- Any project you might need to rerun, such as a dissertation after correcting data.
- Repetitive tasks, such as running the same analysis on many variables.
- Sharing your exact analysis with a supervisor.
How it works
Commands start at the left margin and end with a full stop. Subcommands start with a slash. Comments start with an asterisk and also end with a full stop. Highlight lines and choose Run › Selection to run them. Pasting from dialogs means you rarely need to type syntax from scratch.
Worked example
A syntax file that recodes items, computes scale means and runs every analysis lets you rebuild your entire results section in seconds if one participant’s data is corrected.
Key terms
- Paste
- Writes a dialog’s settings as syntax instead of running it.
- .sps
- Syntax file.
- .sav
- Data file.
- .spv
- Output file.
Common mistakes
- Forgetting full stops.
- Running only part of a file and assuming earlier transformations ran.
How to do it in SPSS
The SPSS syntax
Prefer typing to clicking? Open File › New › Syntax, paste this in, select it and choose Run › Selection. Every dialog's Paste button writes the same kind of code.
* Descriptives for exam score.
DESCRIPTIVES VARIABLES=score age
/STATISTICS=MEAN STDDEV MIN MAX.
T-TEST GROUPS=teaching(1 2)
/VARIABLES=score.Practice data
Download the file used in this lesson and run it yourself in SPSS: you should get the same results as the screens above.
- online.savExam scores for online and in-person students (N = 100)
Now practise it interactively →
Reading is only half of it. Tap through the real SPSS menus, read the output and pick the right write-up in 7 quick questions, with instant feedback on every answer.
Practice for this lesson is part of Pro, with every unit, unlimited hearts and saved progress.