Creating SPSS Syntax Files for Use in Q
SPSS Syntax files are the worst, but easiest-to-create, of the good file formats that can be used in Q.
Q does not support all of the alternative syntax file specifications. What Q does support is best appreciated by the following example of a SPSS syntax file:
* Sample SPSS Syntax file for importing a CSV file.. GET DATA /TYPE=TXT /FILE='sample_sps.csv' /ARRANGEMENT=DELIMITED /* CSV file /FIRSTCASE=2 /* ignore variable names in first line /VARIABLES = Q1 A Q2 F Q3 F Q4 F. /* lists variables in the order they appear. A for text variables, F for numeric. VARIABLE LEVEL Q2 Q4 (NOMINAL) /* categorical /Q3 (SCALE). /* numeric VARIABLE LABELS Q1 'Question one' /Q2 'Question two' /Q3 'Question three' /Q4 'Question four'. VALUE LABELS Q2 Q4 1 'Yes' 2 'No'.
The corresponding data file should then be setup as a CSV file (
.csv) or an ASCII file (
.dat). These are easily created by saving a spreadsheet in Excel as a CSV file (File, Save as..., Save as type: CSV (Comma delimited). The spreadsheet that corresponds to the above syntax is:
.sps file has been created it then needs to be converted into an SPSS data file using Converting SPSS Syntax Files into Data Files.
Further reading: SPSS Alternatives