Troubleshooting
Problem
Is it possible to list multiple dependent variables (DVs) in a single SPSS logistic regression procedure? I have to build many models using the same independent variables (IV) against each of a set of DVs. (Each model will include only a single DV). Does the SPSS macro facility have the ability to do this? Must I manually and iteratively change my target variable?
Resolving The Problem
The Logistic Regression procedure does not allow you to list more than one dependent variable, even in a syntax command. As you suggest, it is possible to write a short macro that loops through a list of dependent variables. The list is an argument in the macro call and the Logistic Regression command is embedded in the macro. The attached syntax file contains a macro and macro call that is a modification of an example from the SPSS Syntax Reference Guide. Look under Looping Constructs" in the "Define-Enddefine" chapter of the syntax guide.
This example uses the "GSS93 subset.sav" file which is included with SPSS and copied to your SPSS directory during installation. (Note that you may need to alter the path in the GET FILE
command to find the file on your own computer.) I created a set of 5 binary DVs (Y1 to Y5) within a DO REPEAT construct. These are not generated from a model with the independent variables, so they're not expected to be predicted by those variables, but they do illustrate the macro.
In the output, you may want to open the Notes section of the output. This is closed by default. Having it open lets you see the name of the DV for each regression output at the very top of that output (in the
syntax log of the Notes outout). You can set the Notes to be open by default by opening the Edit->Options menu and clicking the Viewer tab. In the "Initial Output Stat" area on the left of the Viewer dialog, scroll to Notes under Item, then click the "Shown" radio button and then click OK.
GET FILE='C:\Program Files\SPSS\GSS93 subset.sav'.
* compute a set of binary dependent variables to illustrate the macro.
do repeat y = y1 to y5.
compute y = (uniform(1) > .6).
end repeat.
exe.
DEFINE lrdef (!POS !CHAREND('/') )
!DO !i !IN ( !1)
LOGISTIC REGRESSION !i
/METHOD = ENTER married income4 tvnews region sex educ
/CONTRAST (region)=Indicator /CONTRAST (married)=Indicator
/SAVE = PRED
/CRITERIA = PIN(.05) POUT(.10) ITERATE(20) CUT(.5) .
!DOEND
!ENDDEFINE.
lrdef y1 y2 y3 y4 y5 / .
Related Information
Historical Number
60465
Was this topic helpful?
Document Information
Modified date:
16 April 2020
UID
swg21478073