Date: Tue, 9 Sep 2008 16:53:45 +0100
Reply-To: J Sutar <jsutar@gmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: J Sutar <jsutar@gmail.com>
Subject: loop through a list of
Content-Type: text/plain; charset=ISO-8859-1
Hi,
I would like to create program which performs similarly to the macro
below. I would like to adjust it such that it picks up all variables in the
dataset that start with a certain prefix, for example w12m. The dependent
variables start from w12m01 to w12m85, due to the leading zero of the first
9 dependent variables I struggled to create a SPSS macro. Perhaps a python
solution would work better?
Please not also that there are certain variables missing so for example
w12m36 may not exist hence why I want it to search and find all variables of
a specified prefix.
Many thanks for your help.
Jigs
*
http://www.spsstools.net/Syntax/RegressionRepeatedMeasure/LogisticRegressionByMacro.txt
* I want to perform a logistic regression ten times for ten different
variables without having to copy
* and paste the syntax nine times.
* Solution posted by rlevesque@videotron.ca to newsgroup on 2001/05/10.
GET FILE='c:\program files\spss\employee data.sav'.
* Define macro to do the job.
*/////////////////////////.
DEFINE !logist(dv=!TOKENS(1) /iv=!CMDEND)
LOGISTIC REGRESSION VAR=!dv
/METHOD=ENTER !iv
/CRITERIA PIN(.05) POUT(.10) ITERATE(20) CUT(.5) .
!ENDDEFINE.
*/////////////////////////.
* Do logistic regression of gender using salary and educ.
!logist dv=gender iv=salary educ.
* Do logistic regression of minority using salary and jobcat.
!logist dv=gender iv=salary educ.
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD