Page 1 of 5
Conventions for naming variables in SPSS TM(1)
John F Hall 30 March 2006 (2)
Whenever SPSS is called, it must have a file to be working on. This file is known as the active file and must have at least one variable in it. Imagine a small survey with questions about party support, age last birthday, sex and support for trade unions (on a five-point scale from 1: "make them illegal" to 5: "give my life to keep them in existence"). These are only a few of the questions asked and the data for each completed questionnaire fills more than one line. Thus we need to know:
how the data for each variable has been coded
which line it is on
whereabouts in the line it is
how many columns it occupies
Let us suppose that our variables have been coded as follows:Variable Codes Line number Column(s)
Party support Con, Lab, Lib-Dem, 1 27
Other, None, Refused
Union support 1,2,3,4,5,8,9 2 34
Sex M,F 3 07
Age 16 - 90,99 3 08-09
Let us also suppose that the party support categories were hand-coded from their categories into numeric codes (1=Con, 2=Lab, 3=Lib-Dem, 4=Other, 8=Refused, 0=None), but that sex has been coded in its original alphabetic form. As well as the scale of support for trade unions, some people have refused to give an opinion, others have insisted on "Don't know": these have been coded respectively 8=Refused and 9=Don't know. Age has been recorded as the actual age last birthday in the range 16 to 90, but some people have not given their ages and these have been coded as 99.
Having decided which variables we want for our analysis we must first give them all names for our SPSS run. Variable names in SPSS can be any combination of up to 8 letters and numbers, but the first character must always be a letter of the alphabet. For beginners it may be easier to use a variable name which looks like plain English (e.g. SEX, AGE, PARTY, UNION) and these are known as mnemonic names (after the Greek for memory) and may be easier to remember.
1) SPSS is the registered trademark of SPSS Inc. Details of SPSS products and services are available from http://www.spss.com or from the UK site http://www.spss.com/uk/
2) This document has been updated and edited by John Hall from an earlier version by himself and Jim Ring as applied to mainframe versions. It may be outdated by subsequent developments in SPSS, but the essential logic remains valid as do most of the procedures. The Windows version differs since it treats alpha data as string variables and, apart from initial reading of raw data, may not need to access or write external files as described here. Saved files from the data editor are now suffixed .SAV or .por, but syntax files still have .sps endings. Data capture has advanced by leaps and bounds with the arrival of portable computers which contain questionnaires, direct data entry and automatic quality controls. Manual data preparation is now obsolete for many large scale surveys, but is still used by individual students and researchers for their own projects. It is not clear whether the notion of a raw data matrix in 80-column format still has relevance now that data entry is made directly into packages such as SPSS or indirectly via spreadsheets such as Excel. This could in fact make errors much harder to spot in some instances.