In SPSS, how do I run multiple sets of regressions without having to retype the command each time?
SPSS has a macro facility designed to customize functions from existing commands, allowing you to run a series of commands using different variables in each iteration.
For example, if you want to run a series of regressions using different dependent variables but the same independent variables, you can use the SPSS macro facility to create a list of your dependent variables. When you have defined your macro, you can direct its output to a single regression command, which will then proceed through each of the dependent variables you listed in the macro.
The following example contains three dependent variables
(y1-y3) and three independent variables
(x1-x3). The commands establish a
macro that will run three regressions using each of the dependent
variables against all of the independent variables:
The line DEFINE M () tells SPSS the name of the function
to define. In this example, the macro is called M. The
next line lists the variables that M is equal to, and
consists of the dependent variable names on a line indented at least
one space. Finally, the line !ENDDEFINE specifies the
end of the macro.
The second group of commands shows how this macro is used. Instead of
typing the dependent variable names in the regression command, use the
macro name (M, in this example). This single command
will then execute for each value of M, thus producing
three different regression analyses with one command.
For more about statistical and mathematical software, email the UITS Stat/Math Center, visit the center's web page, or phone 812-855-4724 (IUB) or 317-278-4740 (IUPUI). The center is located in Bloomington at 410 N. Park Avenue, and is open for consultation by appointment Monday-Friday 9am-5pm.
Last modified on March 24, 2011.







