Administrative functions > Data conversion programs > Converting Quantum data and programs with nqtspss > How nqtspss works > Variables and values
 
Variables and values
In order 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;hd=Sex of Respondent
col 15;Base;Male;Female;Not stated='&'
becomes:
VARIABLE LABELS sex "Sex of Respondent"
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 count of respondents in the axis rather than an answer so it is ignored.
nqtspss converts multicoded data into the standard SPSS format. When an axis is multicoded, nqtspss 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. Each variable has two values: 1 if the respondent gave that answer, or 0 if they did not. The definition for @color1 is therefore:
VARIABLE LABELS @color "Colors chosen"
VALUE LABELS @color1
0 "no Red"
1 "Red"
A similar thing happens with numeric codings specified using the Quantum bit/fld statements. nqtspss creates a separate variable for each value on the bit/fld statement and inserts a 0 or 1 in the record depending on whether the respondent gave a particular answer.
For example:
l cars
fld (c126,c129) :3;Base;VW/Audi=500-572;Honda=990,991
is converted into two variables @cars1 and @cars2, each with 0/1 values.
Where the data is truly numeric (that is, numbers rather than numeric codes) the axis is treated as single-coded and the SPSS values are calculated according to the element’s position in the axis. Thus:
1 persons
val c(8,9);Base;i;1 person;2-3 people;4-5 people;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"
An option is available to change the values assigned to each item.
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, nqtspss inserts dummy (-99.99) 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. nqtspss 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, nqtspss starts the variable name with an @ sign. Thus, the statement:
wm1 sex;factor;100;200
appears at the end of the DATA LIST as @weight0, 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 @weight1, the third is named @weight2, and so on.
Exporting data in numeric variables with namedinc statements
If you want to export data in numeric variables to SPSS, you need to create a namedinc statement for each numeric variable.
Format
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.
Options
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.
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 nqtspss works