The example below shows how to run a three-level multilevel model in SPSS.
For this example, we use the https://stats.idre.ucla.edu/wp-content/uploads/2016/02/eg_hlm.sav data set and
SPSS 16.0.1 (please note that this code should work in SPSS versions 11.5 and
higher). In this data set, time (the variable **year**) is nested
within students (the variable **cid**), and students are nested within
schools (the variable **school**). In order to run this example, you
may need to subset the data such that only some of the schools are used.
(Please note that the schools are really numbered 1 through 60. Because
this variable, called **school**, has value labels, you might see numbers
like 2020, 2330, etc. in the **school** column. To turn off the value
labels, click on the value labels button in the upper left of the Data View
window in the Data Editor.)

Note that there are two **random** subcommands. Both are needed to
run this type of three-level model. The first **random** subcommand
provides the random intercepts for schools (the highest level), while the second
**random** subcommand provides the random intercepts for students (the second
level). These subcommands must be listed in this order (e.g., from highest
to lowest level).

For more information, and for more examples, please see the SPSS Command
Syntax Reference for the **mixed** command. Model 6: Multilevel
Analysis has an example with a four-level model.

temporary. select if school < 15. mixed math with year /fixed = year /print = solution /random = intercept | subject(school) /random = intercept | subject(school*cid).