Administrative functions > Preparing a study for Quanvert > Checking the Quantum program file
 
Checking the Quantum program file
A Quantum program designed to create tables in Quantum is not necessarily written in a form which will produce the best results when the data is flipped for use with Quanvert. The following is a list of changes you might want to make to the Quantum spec before flipping the data. Flipping is the process by which a Quantum specification is inverted to form a Quanvert database. For more information, see Creating and maintaining Quanvert databases.
1 Make sure axis names reflect the contents of the axis. Names such as age, childs and tried are much more helpful than ax01 or q1.
2 Put axis titles on tt or n23 statements within the axes, or define them using hd= on the l statement.
Of the three options, hd= is the best choice for two reasons:
When the axis is used as the columns of the table Quanvert prints the hd= text above the columns of the table. Quanvert also does this with n23 texts, but if you use tts, Quanvert prints them at the top of the table which makes it unclear whether they belong to the rows or the columns.
If you will be using the database in a multiproject project, you can change the hd= text between projects without having to change the titles of earlier projects to match. If you use n23s, and you merge axes based on element texts, mflip does not merge elements that are identical apart from the subheadings.
Any axis which may be used as a third or higher dimension should have n23 statements. tt statements following tab statements are ignored.
3 Split up column axes containing more than one type of information into the individual axes for each of the questions involved in the axis. For example, if the column axis contains sex, age, and marital status information, split it into three separate axes. You can still keep the original axis, but by splitting it you offer Quanvert users the choice of using just part of it if the original is too wide to be displayed across the screen.
4 Groups of variables can be made in Windows-based Quanvert using the Variable groups command on the Admin menu. This command lets you create variable groups by selecting variables and providing a name for the group. However, you can also establish variable groups in Quantum through the use of the keyword qvgroup.
The syntax of this keyword is:
qvgroup group_name;var1;var2; ...
where group_name defines the name of the group and var# can be a categoric, alpha or numeric variable. This statement can appear anywhere in the tab section.
For example, the group personal could encompass the variables age, sex, class and marital status and is defined as follows:
qvgroup personal;age;sex;class;marital_status
Groups can be listed in Quanvert by clicking on the Groups button in the Available variables frame. When you select a group, Quanvert restricts the display of variables to those belonging to that group.
Another benefit of grouping variables is to make it easier to standardize on sets of variables. For example, you could group a set of variables that relate to particular questions in the questionnaire. This allows the Quanvert user to easily view and select all the variables in a group, for example, for exporting to SAS.
5 Put axis conditions on the l statement rather than on an n00 if the condition refers to all elements in that axis. Using n00s in these circumstances increases the amount of disk space and processing time required to deal with the data.
If the axis is filtered, ensure that this is clear to the Quanvert user by amending the text of the base element or adding an axis title that explains who is included in the axis.
6 Ensure that each axis is named on at least one tab statement. Axes are not flipped if:
they contain more than 32,760 elements;
they have illegal or reserved names and the .ax files cannot be renamed for any reason (see item 8 below);
they are weighting axes which do not have a tab statement, in which case the necessary information is not present in Quantum’s intermediate file;
A warning message is issued in each case.
7 Do not leave column axes without row text (that is, only g and p statements) as this causes problems if the axis is used as a row axis in Quanvert. Insert n01 statements with suitable text.
8 The words dummy, project, cancel, help, q, qu, qui, quit, restart and same have special meanings within Quanvert. If you have axes with these names, rename them. If you do not rename them, Quantum flips them with temporary names:
axes
are renamed
tmpaxnn
numeric variables
are renamed
tmpincnn
text variables
are renamed
tmpalpnn
where nn is 01, 02, 03, and so on. nn is reset to 01 for each variable type.
9 Numeric variables, which are defined using the namedinc statement, are automatically included in the database. If you want to control which numeric variables are flipped, create a flip configuration file naming the variables to be flipped. For more information about the flip configuration file, see Flip configuration file.
To define a numeric variable, add a statement of the form:
namedinc data_spec [;options]
after any global titles but before the tab statements.
The data_spec can be anything which gives an integer or float result.
The options are:
Option
Explanation
anlev=level
Specifies the level of the variable; this is mandatory in levels data.
varname=name
User-defined name of the variable; this is optional.
vartext=text
One-line description of the variable; this is optional.
missing=logexp
Where logexp is a logical expression. Treat any record that satisfies the logical expression as a record with a missing value. This is optional.
For example:
namedinc shop;vartext=Number of shops visited
If, however, this variable 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 sets the description to the same as that given or assigned as its name.
10 To make the record serial numbers available in the database, insert statements in the Quantum edit to create a variable called serial and copy the serial number into it. Then add a namedinc statement before your tab statements. For example:
namedinc serial;vartext=Respondent's serial number
11 Conditions on filters (c= on flt and flt=) are ignored. To make them part of the database, create an axis in which each filter condition is an element. Remember to include a tab statement for this axis.
12 To avoid wrap-around on an 80-column screen, set the page width to less than 80 columns with pagwid= on the a statement, and shorten text on g statements accordingly. If you remove the g statements altogether, Quanvert will format the column headings internally which allows users to select a suitable page width during the session.
13 Always use foot in preference to bot. The latter causes the tables to scroll off the top of the screen.
14 Quanvert does not add tables. Axes on add statements are treated in the same way as those on tab statements. However, be sure to remove any dummy elements (that is, n01;dummy) from the axes named on the related tab statements.
15 The following points apply to databases created from Quantum programs containing weighting:
All weight matrices are copied into the Quanvert database and the user may weight tables using any matrix of their choice.
Generally Quanvert users find it easier if weighting matrices are identified by names that reflect the characteristics on which the weights are based, rather by numbers. To achieve this, use the varname= option on the wm statements that define the weighting matrices. For example:
wm1 sex;varname=gender;input;50;50
When Quanvert displays the contents of an axis, it displays unweighted and weighted figures, where the weighting matrix used is, by default, the first matrix defined in the Quantum program.
To create the database with a default weighting matrix, name that matrix on the a statement using wm=. Quanvert will then display figures weighted using this matrix and will create tables using this matrix unless the user chooses a different matrix or requests an unweighted table.
The flip process silently ignores wm= on tab statements. It also ignores wm= with any value other than zero on elements, but issues a warning message for each option ignored.
wm=0 on elements is carried forward into the database.
Quanvert users can choose between creating weighted and unweighted tables. If a Quantum axis contains both weighted and unweighted base elements remove one of them.
16 Trailer card data is best analyzed using levels. However, when trailer cards are analyzed according to the contents of the variables firstread, lastread and so on (that is, analysis levels are not used), there are two points to consider:
Wherever possible, axes that are not at the lowest level should have a filter (for example, c=lastread) as an option on the l statement not the tab statement.
Create an axis containing an element for each level. For example:
l level
n01Household;c=thisread1
n01Person;c=thisread2
n01Trip;c=thisread3
17 In a levels run, the following points apply:
Axes are flipped at the level indicated by their anlev= keyword.
Numeric variables defined using inc= on the tab statement are flipped at the level of the tab statement.
For backward-compatibility, inc= numeric variables are still flipped, but when writing new Quantum specs, numeric variables should now be defined using namedinc in preference to inc=.
You must not use a numeric field or variable in the Quantum spec at more than one level.
In weighted runs, each level must have a wm statement associated with it. If there is only one set of weights which applies to all levels, it must be repeated at each level.
If the database is to form part of a panel study, it may be necessary to set up cross-referencing for the various levels (see item 18 below and also Setting up panel studies for Quanvert Text).
Define at least one table at each level so that the levels cross-reference (qvlv*) and weights files contain the correct information for each level.
For more information about numerics in levels data, see Numerics with levels.
18 If the data file contains text fields which need to be available as alpha variables in Quanvert, add a statement of the form:
namedalpha col_spec [;options]
after any global titles but before your tab statements.
Where col_spec specifies the start and end columns of the text in the C array.
The options available are:
Option
Explanation
anlev=level
Specifies the level of the variable; this is mandatory in levels data.
varname=name
User-defined name of the variable; this is optional.
vartext=text
One-line description of the variable; this is optional.
For example:
namedalpha c(210,259);varname=address;vartext=Your address
reads each respondent’s address into the variable ‘address’. 50 columns are read starting in column 210.
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 sets the description to the same as that given or assigned as its name.
In a levels job, you must enter the level number as determined by its position in the levels file (for example, 5 for the fifth level defined), and all other parameters are as described above. This statement, therefore, might be written as:
namedalpha c(210,259);anlev=2;varname=address;vartext=Your address
In a panel study, you can use namedalpha for setting up the cross-referencing for the levels in the database. For more information on panel studies, see Setting up panel studies for Quanvert Text.
19 On Windows, you can play sound (.wav) files of verbatim open end responses. To do this, you must create an alpha variable defining the name and, if necessary the path, of the sound files. Use the statement:
namedalpha col_spec [;options]
after any global titles but before your tab statements. col_spec defines the start and end columns in the C array that hold the name and, if necessary the path, of the audio file for each respondent.
For example, to create a Quanvert alpha variable called noise that holds the names of the audio files, create the following alpha variable:
namedalpha c(106,110);varname=noise;vartext=Sound file for respondent
If the sound files are stored in the Quanvert database directory, you do not need to specify the path. However, sound files are large and you might want to store them in a separate directory, in which case, the column specification must specify the path as well as the filename. You can either specify the path relative to the Quanvert database directory or as an absolute path.
From Quanvert, you export the alpha variable as an ASCII profile. Then when you view the exported data, you see a list of the .wav files with a loudspeaker symbol next to each name. If your PC has a sound card, you can listen to the recording by clicking on the filename.
20 Quanvert can deal with missing values in numeric variables. These are referred to as DNA (question did not apply to respondent) and NA (question was applicable to the respondent but was not answered) and have the values -2.0e9 and -1.0e9 respectively. You might have coded these as, say, & for DNA and blank for NA.
Quantum does not create these special values automatically, but you can create them when the data is flipped by including code of the form shown below in the edit section of the Quantum program:
real dn103 1
ed
dn103=c103
#c
if (c[103]==2048) q_dn103 = -2.0e9;
else if (c[103]==0) q_dn103 = -1.0e9;
#endc
return
end
This example is setting missing values for a numeric variable in column 103. The lines of C code between the #c and #endc statements are the equivalent of:
if (c103'&') dn103=DNA;
else; if (c103' ') dn103=NA
21 process statements create databases with misleading counts of respondents, so write an edit program to format the data into the standard card format for a levels job first. Then modify the axes definitions in the original Quantum program to match the new data format. The example below illustrates a typical process problem. If there are 1,000 respondents and the Quantum program is:
ed
c180='1'
do 5 t1 = 112,116,2
if (c(t1,t1+1)=$ $) go to 5
c(181,182) = c(t1,t1+1)
process
5 continue
c180=' '
end
tab filmax region;c=c180'1'
ttlBase: Number of Viewings
flt;c=c180' '
tab age sex
Quanvert will claim to have a base of 3,000 respondents rather than 1,000 since respondents are counted each time they pass through the tab section.
In addition, since flip ignores filter conditions on flt statements (see point 11 above), the table of age by sex will report 3,000 respondents rather than 1,000, even though the percentages will be correct. If some respondents bypass process because one or more of the fields is blank, the percentages will be incorrect as well.
22 If disk space is likely to be a problem, consider the following as ways of reducing the amount of space required:
Use numcode on the l statement of single-coded axes. This reduces the amount of space required for Quantum’s intermediate files and also the length of time taken to create the Quanvert database.
Use fac= instead of n25 and inc=, because n25 creates .mul files whereas fac= does not.
23 Check all elements that are flagged with norow, nocol or nohigh and decide whether these options are really necessary in the database.
These options carry forward from the Quantum spec into the database and also into any new axes that the user creates using axes that contain those elements. For example, if an axis contains an element flagged with nocol, and that element is used in a new axis, that element will not be printed if the new axis is used as the columns of the table.
24 The current versions of Quanvert cannot create n25 elements in new axes. If the user creates a new axis using an axis that contains an n25, the n25 will be missing from the new axis.
25 If you want Quanvert users to be able to request special T statistics:
Add an nsw option to the a; statement. If the Quantum run contains this keyword but there are no tstat statements in the run, the default for the database will be no T statistics. However, the Quanvert user will be able to select whichever tests they want to run and Quanvert will have all the information it needs to run the test.
If some axes are multicoded, add the overlap keyword to the a; statement. This will ensure that Quanvert uses the formulae that take into account places where a respondent is present in two or more of the elements being tested.
The default minimum base for T statistics is 30. If the base (effective base in weighted tables) is less than 30, the test is not run. You can specify a different minimum base for the database using the keyword minbase= on the a; statement.
The default value for a small base is 100. You can specify your own value for the database using the keyword smallbase= on the a; statement.
The default confidence level is 90%. Use clevel= on the a; statement to set a different default.
Quanvert does not normally save its intermediate figures in a debugging file. Specifying tstatdebug on the a; statement alters this so that the default is to save debugging information in the file tstat.dmp.
A tstat statement in an axis in the Quantum spec carries over into the Quanvert database, so that whenever the user selects that axis the T statistic comes into effect with any options that were also defined on the tstat statement. The user may turn off the T statistic or alter its options using Quanvert. If you want the default to be no T statistics, remove all tstat statements from the Quantum axes.
Any significance test that calculates means may only be run if the axis contains an n12 element. You might want to add n12 statements to axes where you think users may want to apply these tests.
26 Windows-based Quanvert does not produce reliable figures for percentiles that have been specified using n01 statements with inc=. When you are preparing a study for Windows-based Quanvert, you should therefore specify percentiles by using fac= on the elements and the n30 statement.
See also
Preparing a study for Quanvert