Creating SPSS Syntax Files for Use in Q

From Q
Jump to navigation Jump to search

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..
         /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'.
                   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:

Example contents of a CSV file for use with SPSS Syntax in Q

Once a .sps file has been created it then needs to be converted into an SPSS data file using Converting SPSS Syntax Files into Data Files.

See also

File Formats Supported by Q

Further reading: SPSS Alternatives