Sunday, February 11, 2007

SPSS+Python: First script

The below scripts reads Excel file. Than the python program pairs variables, that will be compared using paired t-test.
GET DATA
/TYPE=XLS
/FILE='/Users/marcin/Desktop/myPublicationDataAnalysis_newAniso/fs_Lud_byMarcin10/VOT/Sta_fs.xls'
/SHEET=name 'Lat'
/CELLRANGE=full
/READNAMES=off
/ASSUMEDSTRWIDTH=32767.

DATASET NAME DataSet1 WINDOW=FRONT.

BEGIN PROGRAM.
import spss
from spss import Submit

ScalesC=['V'+str(i+1) for i in range(1,10)]
ScalesOA=['V'+str(i+11) for i in range(1,10)]

for v in zip(ScalesC,ScalesOA):
c= "T-TEST PAIRS="+v[0]+" WITH "+v[1]+" (PAIRED) /CRITERIA=CI(.9500) /MISSING=ANALYSIS."
Submit(c)
END PROGRAM.