SPS File Format
The following is an example of an SPS format file for a 6 question survey:
DATA LIST FILE="C:\Data\SampleData.dat"/
V1 1 V2 2 V3 3
V4 4 V5 5 V6 6
.
VARIABLE LABELS
V1 'Q1 How often do you enjoy Coffee'
V2 'Q2 How often do you enjoy Water'
V3 'Q3 How often do you enjoy Juice'
V4 'Q4 How often do you enjoy Milk'
V5 'Q5 Gender'
V6 'Q6 Age group'
.
VALUE LABELS
V1 TO V4
1 'Never'
2 'Sometimes'
3 'Often'
4 'Twice a day'
5 'Like a fish to water' /
V5
1 'Male'
2 'Female'
9 'Not answered' /
V6
1 '10 to 15'
2 '16 to 20'
3 '21 to 25'
4 '26 to 30'
5 '31 to 35'
6 '36 to 40'
7 '41 to 45'
8 '46 to 50'
9 '51+' /
.
The Data List and Survey Data
Fixed Column Format Data
In the example above, the data is contained in a separate file (C:\Data\SampleData.dat) in a fixed column format.
The fixed column format is defined in the DATA LIST
section at the top of the .sps file. In this case the definition specifies that the response to question V1 is in column 1, the response to question V2 is in column 2, and so on:
DATA LIST FILE="C:\Data\SampleData.dat"/
V1 1 V2 2 V3 3
V4 4 V5 5 V6 6
.
The period/full stop is used throughout the file to signify the end of a particular section.
The data file would be similar to the following. Each line represents the set of answers from a single respondent. In this example the first respondent answered "2" ("Sometimes") to question V1, "3" ("Often") to question V2, and so on:
234116
122514
321421
444527
With the fixed format, there must be no spaces at the start of the lines, otherwise these will be interpreted as responses.
For example if a space is incorrectly added to the start of the second line, then this would be treated as that person's response to question V1, with their real response to question V1 ("1" / "Never") incorrectly treated as their response to question V2:
234116
122514
321421
444527
Comma Separated Data
It is also possible for the data to be stored in a comma separated format, in which case the DATA LIST
section of the .sps file would be similar to the following:
DATA LIST , FILE="C:\Data\SampleData.dat"/
V1 V2 V3
V4 V5 V6
.
When using a comma separated format, the DATA LIST
section simply specifies the order in which the responses appear in the data. In this case the responses are in the order V1, V2, V3, V4, V5, and then V6. The data file would be similar to the following:
2,3,4,1,1,6
1,2,2,5,1,4
3,2,1,4,2,1
4,4,4,5,2,7
Inline Data
It is also possible for the data itself to be stored inline in the .sps file. In this case the DATA LIST
section would be similar to the following:
DATA LIST , /
V1 V2 V3
V4 V5 V6
.
The data itself appears at the end of the .sps file, enclosed in BEGIN DATA
and END DATA
statements:
BEGIN DATA
2,3,4,1,1,6
1,2,2,5,1,4
3,2,1,4,2,1
4,4,4,5,2,7
END DATA.
Although it is possible to have inline data in FIXED format at the end of the .sps file, this is not recommended. The SuperCHANNEL SPSS driver interprets the line containing the END DATA
statement as a response, and incorrectly adds the values E, N, D, A, and T to the classifications. If you are using fixed format data you must do so in a separate data file (which does not use the enclosing BEGIN DATA
and END DATA
statements).
IDs in Data
The ID
keyword in the DATA LIST
section is used to indicate that there are record numbers before each data row. For example:
DATA LIST , / ID
V1 V2 V3
V4 V5 V6
.
The corresponding data section would be similar to the following:
BEGIN DATA
1
2,3,4,1,1,6
2
1,2,2,5,1,4
3
3,2,1,4,2,1
4
4,4,4,5,2,7
END DATA.
Variable Labels
The VARIABLE LABELS
section specifies the labels for each question. These appear in the SuperSTAR clients as the classification names.
For example:
File definition:
TEXT
| Survey data in SuperWEB2: |
Value Labels
The VALUE LABELS
section specifies the possible responses for each question. These labels display in the SuperSTAR clients as the classification values.
In this example, questions V1 to V4 have the same possible answers. The order in which the questions are specified in the DATA LIST
section is used to determine which questions are consecutive and are therefore implied by V1 TO V4
.
File definition:
TEXT
| Survey Data in SuperWEB2: |