This page is designed to be a resource for all the simple syntax in SPSS that’s nevertheless easy to forget, and is as much a reference for me as it is hopefully to you!
Regression
Regression
REGRESSION /MISSING LISTWISE /STATISTICS COEFF OUTS R ANOVA /CRITERIA=PIN(.05) POUT(.10) /NOORIGIN /DEPENDENT DV /METHOD=ENTER IV1 /METHOD=ENTER IV2.
ENTER forces SPSS to enter your IVs in each block at a time. Each new line represents a new block.
Reliability and Correlations
Reliability
RELIABILITY /VARIABLES = Variable1, Variable2 /FORMAT=NOLABELS /SCALE(ALPHA)=ALL /MODEL=ALPHA /STATISTICS=SCALE /SUMMARY=TOTAL.
Correlations
CORRELATIONS /VARIABLES= Variable1 Variable2.
Optional:
/PRINT=TWOTAIL NOSIG /MISSING=PAIRWISE
GLMs
Between Subjects
GLM DependentVariable BY Category /PLOT = PROFILE(Category) /CONTRAST(Category) = SPECIAL(-1 0 1).
Mixed Design
GLM Dependent1 Dependent2 Dependent3 BY Category /WSFACTOR NameofDV [1] #of levels [2] /PLOT = PROFILE(NameofDV*Category).
[1] Name this any (single) word you want; it’s just used to help you keep track of the levels of the DV and double-checking output in SPSS.
[2] If the DVs aren’t “stacked” based on another variable, just use the number of DVs in the syntax (for example, this would be /WSFACTOR NameofDV 3).
GLM With Contrast
GLM DependentVariable BY Group [1] /CONTRAST(Group) = SPECIAL(-1 0 1).
[1] Group is your between-subjects factor, not a word with any intrinsic meaning in SPSS syntax.
Descriptive Statistics
Basic Descriptive Statistics Tables
A quick way to get the basics in one chart. The tables will always show n.
DESCRIPTIVES Variable1 TO Variable2 /STATISTICS MEAN STDDEV
Z-Scores
Z-Scores
A command that’s not intuitive at all: to create Z (normalized) scores
DESCRIPTIVES CurrentVariable (ZConvertedVariable) /SAVE.
The “/SAVE” command is what creates the Z-score.
You can name the new variables whatever you want in the parenthesis, or if you don’t SPSS will just add “Z” in front of the current variable’s name.
Split Data
Split Analysis Based on a Variable
To run syntax separately by some variable you “split” it by that variable.
SORT CASES BY CategoryVariable. SPLIT FILE BY CategoryVariable. **All syntax** SPLIT FILE OFF.
If/Do If/Select If Loops
If Statements
IF STATEMENT EQ Something. COMPUTE VARIABLE[1] = Value.
Do If Statements
DO IF STATEMENT EQ Something COMPUTE VARIABLE = Value. ELSE IF STATEMENT EQ Something COMPUTE VARIABLE = Value. ELSE COMPUTE VARIABLE = Value. END IF.
[1] You have to include “COMPUTE” even if the variable already exists.
Select If Statements
Always do temporary unless you want to delete data.
TEMPORARY. SELECT IF (Variable1 EQ 'Value'[2]).
TEMPORARY. SELECT IF NOT(Variable1 EQ 1 OR Variable2 EQ 2).
[2] In single quotes if it’s nominal
Logical Expressions
EQ, = Equal to NE, ~= Not equal to LT, < Less than LE, <= Less than or equal to GT, > Greater than GE, >= Greater than or equal to AND, & And OR, | Or NOT Not