How can I loop through variables in SPSS? I want t

2019-02-10 17:02发布

Is there a "native" SPSS way to loop through some variable names? All I want to do is take a list of variables (that I define) and run the same procedure for them:

pseudo-code - not really a good example, but gets the point across...

for i in varlist['a','b','c']
do
  FREQUENCIES VARIABLES=varlist[i] / ORDER=ANALYSIS.
end

I've noticed that people seem to just use R or Python SPSS plugins to achieve this basic array functionality, but I don't know how soon I can get those configured (if ever) on my installation of SPSS.

SPSS has to have some native way to do this...right?

7条回答
The star\"
2楼-- · 2019-02-10 17:47

Here's a page from UCLA's Academic Technology Services that describes looping over lists of variables. Quote,

"Because we are looping through more than one variable, we will need to use Python."

In my experience, UCLA ATS is probably the site with the best coverage of all of the major statistical computing systems. If they say you need Python... you probably need Python.

Er... sorry for being that guy, but maybe it's time to switch to a different stats system.

查看更多
登录 后发表回答