Administrative functions > Data conversion programs > Converting Quantum data and programs with qtspss > How qtspss works > Variables and values
 
Variables and values
To understand how an axis becomes a variable, look at the different types of element you can have and see how they appear in the SPSS files. The simplest axis is one in which the elements are single-coded. For example, the axis:
l sex
col 15;Base;Male;Female;Not stated='&'
becomes:
VARIABLE LABELS sex
VALUE LABELS sex 1 "Male" 2 "Female" 3 "Not stated"
In the axis, the element’s condition determines the code which represents the response in the data. In the variable, the values for each answer are determined solely by the element’s position in the axis. Thus, Not stated is the third answer so it becomes value 3 in the SPSS variable.
The base element is a count of respondents in the axis rather than an answer so it is ignored.
qtspss converts multicoded data into the standard SPSS format. When an axis is multicoded, qtspss creates as many variables as there are elements in the axis. Each variable is named according to the axis name, but has a numeric suffix associated with the element’s position in the axis. For example, the multicoded axis:
l color;hd=Colors chosen
col 15;Base;Red;Blue;Green;Yellow;Others='&'
is converted into five variables named @color1 to @color5. The variable names start with @ indicating that they are derived variables rather than variables related directly to a Quantum axis.
Where the data is numeric (specified using the Quantum val statement), the axis is treated as single-coded and the SPSS values are calculated according to the element’s position in the axis. Thus:
l persons
n10TOTAL
val c(8,9);Base;i;1 person;2-3 people;4-5people;6-9 people;
+More than 9 people=10+
becomes:
VARIABLE LABELS persons
VALUE LABELS persons
1 "1 person"
2 "2-3 people"
3 "4-5 people"
4 "6-9 people"
5 "More than 9 people"
qtspss cannot deal with fld/bit statements, so you must convert them to their col/val/n01 equivalents.
If a respondent answers all questions in the questionnaire, the record will contain one value for each variable. If some questions are unanswered, or if filtering excludes a respondent from the axis, qtspss inserts dummy (999) values in the appropriate positions in the records. In SPSS, the same dummy value is used for all variables and is called the missing value.
Quantum runs can be weighted. In Quantum, weights (apart from pre- and postweights) are defined in the tab section. qtspss converts the weighting matrix into a variable with a numeric suffix, and appends each respondent’s weight to the end of the record. Because the weight variable is not a bona fide Quantum axis, qtspss starts the variable name with @ (ampersand). Thus, the statement:
wm1 sex;factor;100;200
appears at the end of the DATA LIST as @weight1, and records have either 100 or 200 as their last value, depending on whether the respondent is male or female.
If the run contains more than one weighting matrix, the second matrix is named @weight2, the third is named @weight3, and so on.
If you want to export data in numeric variables to SPSS, you need to create a namedinc statement for each numeric variable. namedinc statements should be defined after any global titles but before your tab statements and are in the form:
namedinc data_spec [;options]
The data_spec can be anything which gives an integer or float result.
The options available are:
Option
Explanation
anlev=
Specifies the analysis level; this is mandatory for levels data.
varname=
User-defined name of the variable; this is optional.
vartext=
One-line description of the variable; this is optional.
missing=
missing= as with inc=; this is optional.
For example:
namedinc shop;vartext=Number of shops visited
If, however, a numeric variable called shop does not exist, you can define it by specifying which columns it refers to. It could, for example, be written as:
namedinc c(213,214);varname=shop;vartext=Number of shops visited
If you do not specify a variable name (varname=), Quantum sets the name to the variable’s data_spec. If you do not assign a description to the variable (vartext=), Quantum makes the description the same as its name.
Numeric variables do not have a predefined set of values, so there is no VALUE LABELS section. Instead, the exact value of the variable is placed on a new line underneath the record in the data file. A comment of the form:
*    shop <--- shop
is placed at the end of the file.
Note Before the namedinc statement was introduced into Quantum in version 5e.5b, numeric variables could be exported to SPSS by specifying the variable with inc= on a dummy tab statement. For backward-compatibility, this method can still be used, but when writing new Quantum specs, you should now use namedinc instead.
See also
How qtspss works