如何在SPSS中将此脚本从1循环到50?

时间:2014-10-30 20:27:29

标签: spss

for i=1:50

DATASET ACTIVATE DataSet1.
QUICK CLUSTER ZlnPrice ZCPUGhz ZWeightgramm ZDisplayinch ZCameraMp
  /MISSING=LISTWISE
  /CRITERIA=CLUSTER(i) MXITER(10) CONVERGE(0)
  /METHOD=KMEANS(NOUPDATE)
  /PRINT INITIAL.

end

我想将CLUSTER(i)从1循环到50.我怎样才能解决这个问题?我想避免蛮力。

1 个答案:

答案 0 :(得分:0)

有几种方法。一个是制作宏观功能。

define !myloops()
!do !i = 1 !to 50
QUICK CLUSTER ZlnPrice ZCPUGhz ZWeightgramm ZDisplayinch ZCameraMp
  /MISSING=LISTWISE
  /CRITERIA=CLUSTER(i) MXITER(10) CONVERGE(0)
  /METHOD=KMEANS(NOUPDATE)
  /PRINT INITIAL.
!doend
!enddefine.

Select and Run that - read into processor memory.

Then issue commands.
DATASET ACTIVATE DataSet1.
!myloops.

You're there.