Quantum User’s Guide Volume 2 Basic Tables TUM90518U2
COPYRIGHT
2000 BY SPSS LIMITED
All rights reserved as an unpublished work, and the existence of this notice shall not be construed as an admission or presumption that publication has occurred. No part of the materials may be used, reproduced, disclosed or transmitted to others in any form or by any means except under license by SPSS Ltd. or its authorized distributors. SPSS Limited
Maygrove House 67 Maygrove Road LONDON NW6 2EG
England Please address any comments or queries about this manual to the Support Department at the above address, or via e-mail to:
[email protected] All trademarks acknowledged.
Contents List of figures ....................................................................................................................v About this guide ............................................................................................................ vii 1 1.1
Introduction to the tabulation section .........................................................................1 Creating tables ......................................................................................................................1 Creating the cells of the table ................................................................................................2 Types of data in the cells .......................................................................................................3 Table text ...............................................................................................................................5
2 2.1 2.2 2.3
The hierarchy of the tabulation section ......................................................................7 Components of a tabulation program ..................................................................................7 Hierarchies of Quantum .......................................................................................................8 Defining run conditions ........................................................................................................8 Options on a, sectbeg, flt and tab statements ........................................................................9 Switching off options ..........................................................................................................32 The default options file .......................................................................................................32 Sample tables ......................................................................................................................33 Total percentages .................................................................................................................33 Cumulative column percentages .........................................................................................34 Indices .................................................................................................................................35 Table of means ....................................................................................................................36
2.4 2.5
3 3.1 3.2 3.3 3.4
3.5
3.6
3.7
3.8
Introduction to axes........................................................................................................39 Naming the axis ..................................................................................................................39 Types of elements within axes ...........................................................................................45 Defining conditions for an element ....................................................................................46 Special conditions ................................................................................................................48 Count-creating elements .....................................................................................................49 The n01 statement ...............................................................................................................50 The n15 statement ...............................................................................................................56 Creating a base ....................................................................................................................56 Subheadings and extra text .................................................................................................57 Statements for extra text ......................................................................................................58 Subheadings in the axis .......................................................................................................62 Text continuation statements ...............................................................................................66 Netting ................................................................................................................................67 Automatic indentation of element texts ...............................................................................70 Text-only net elements ........................................................................................................71 Accumulation of suppressed elements by net level .............................................................72 Percentaging with nets .........................................................................................................73 Axes within axes ................................................................................................................76 Defining subaxes .................................................................................................................77 Creating tables from subaxes ..............................................................................................80 Printing characters next to absolutes ..................................................................................81
Contents / i
Quantum User’s Guide Volume 2
4 4.1
More about axes .............................................................................................................. 83 The col statement ............................................................................................................... 83 Continuing col statements ................................................................................................... 85 Dealing with don’t knows ................................................................................................... 86 Conditions on col statements .............................................................................................. 86 Bases on col statements .......................................................................................................87 Subheadings with col .......................................................................................................... 88 Text-only elements with col ................................................................................................ 88 4.2 The val statement ............................................................................................................... 89 Testing for arithmetic equality ............................................................................................ 89 Testing ranges ..................................................................................................................... 92 Combining arithmetic equality and range testing ............................................................... 93 Counting missing values ..................................................................................................... 94 4.3 Responses with numeric codes: fld .................................................................................... 94 4.4 Responses with numeric codes: bit .................................................................................... 97 When bit is better than fld ...................................................................................................99 Incrementing tables more than once per respondent ........................................................... 99 4.5 Filtering within an axis .................................................................................................... 102 4.6 Redefining a base ............................................................................................................. 103 4.7 Pagination ......................................................................................................................... 105 Automatic pagination ........................................................................................................ 105 Manual pagination .............................................................................................................108 Repeating elements on continued tables ........................................................................... 109 4.8 Options on n, col, val, fld and bit statements ................................................................... 112 Output options ................................................................................................................... 113 Data options ...................................................................................................................... 119 4.9 Percentage differences ..................................................................................................... 125 4.10 Distributing records from one element across the axis .................................................... 129 5 5.1 5.2 5.3 5.4 5.5
5.6 5.7
5.8 5.9
ii / Contents
Statistical functions and totals.................................................................................. 133 Creating totals .................................................................................................................. 133 Statistical statements ........................................................................................................ 136 Averages ........................................................................................................................... 137 The mean, standard deviation, standard error and error variance .................................... 138 The n25 statement ............................................................................................................ 139 Using factors ..................................................................................................................... 140 Using n25;inc= .................................................................................................................. 142 Weighted runs ................................................................................................................... 143 The sum of factors ............................................................................................................ 144 Creating percentiles and medians .................................................................................... 144 Percentiles from factors .................................................................................................... 145 Percentiles based on numeric variables ............................................................................ 149 Interpolation with percentiles ............................................................................................ 151 Printing the effective base ................................................................................................ 153 Formulae .......................................................................................................................... 155 Sum of factors ................................................................................................................... 156 Mean .................................................................................................................................. 156 Standard deviation ............................................................................................................. 156 Standard error of the mean ................................................................................................ 157
Quantum User’s Guide Volume 2
Sample variance of the mean ............................................................................................ 157 6 6.1 6.2 6.3 6.4 6.5
6.6 6.7 6.8 7 7.1 7.2 7.3 7.4 7.5
7.6
7.7
8 8.1 8.2 8.3 8.4 8.5 8.6 8.7
Using axes as columns ............................................................................................... 159 Maximum width for column headings ............................................................................. 159 Fully automatic set-up ...................................................................................................... 160 Defining breakpoints in element texts ............................................................................. 163 Defining column widths with colwid= ............................................................................ 164 Manual set-up ................................................................................................................... 164 The banner text ................................................................................................................. 165 Spacing for groups of g statements ................................................................................... 166 Printing numbers in columns ........................................................................................... 167 Underlining column headings .......................................................................................... 168 Splitting large tables ........................................................................................................ 169 Creating tables............................................................................................................... 171 Creating a table ................................................................................................................ 171 Multidimensional tables .................................................................................................... 171 Options on the tab statement ............................................................................................ 174 Cross-tabulating data variables ......................................................................................... 175 Multilingual surveys ........................................................................................................ 176 The and statement ............................................................................................................ 178 Combining tables ............................................................................................................. 179 Horizontal and vertical combination ................................................................................. 179 Adding tables .................................................................................................................... 182 Dividing one table by another ........................................................................................... 186 Printing more than one table per page ............................................................................. 188 A set of short tables that do not exceed the page width .................................................... 190 Short tables with wide breakdowns .................................................................................. 190 Paper saving ...................................................................................................................... 191 Controlling titles, footnotes and bottom text .................................................................... 191 Pasting one table underneath another ............................................................................... 195 Logical and physical page numbers .................................................................................. 196 Suppressing percentages and statistics with small bases ................................................. 196 What are ‘percentages’ and ‘statistics’? ........................................................................... 197 Requesting suppression ..................................................................................................... 197 How suppression works .................................................................................................... 198 Examples ........................................................................................................................... 199 Table texts....................................................................................................................... 203 Table titles ........................................................................................................................ 203 Titles for T statistics tables only ....................................................................................... 206 Underlining titles ............................................................................................................. 207 Printing text at the foot of a table ..................................................................................... 208 Printing text at the bottom of a page ................................................................................ 210 Table numbers .................................................................................................................. 210 Page numbers ................................................................................................................... 213 Controlling justification for individual tables .................................................................. 215
Contents / iii
Quantum User’s Guide Volume 2
9 9.1 9.2 9.3
Filtering groups of tables............................................................................................ 217 General filter statements .................................................................................................. 217 Named filters .................................................................................................................... 220 Nested filter sections in table specs ................................................................................. 221
10 Include and substitution ............................................................................................. 225 10.1 Filing and retrieving statements ....................................................................................... 225 10.2 Filing and retrieving non-identical statements ................................................................. 227 Symbolic parameters for columns ..................................................................................... 228 Symbolic parameters for codes ......................................................................................... 232 Symbolic parameters for text ............................................................................................ 234 Symbolic parameters for variables .................................................................................... 235 10.3 Assigning global values to symbolic parameters ............................................................. 237 10.4 Grid tables ........................................................................................................................ 238 Grid axes ........................................................................................................................... 238 #def with grids .................................................................................................................. 243 Options in grid axes ..........................................................................................................243 Cross-tabulating grid axes ................................................................................................. 244 Grid axes in levels jobs ..................................................................................................... 245 Weighted grids .................................................................................................................. 246 10.5 Filtered columns in grid tables ......................................................................................... 247 10.6 Exporting grid axes in Quanvert ...................................................................................... 249 Reading non-standard data files ........................................................................................ 250 11
A sample Quantum job ................................................................................................ 253
A
Limits ............................................................................................................................... 265
B B.1 B.2
Error messages ............................................................................................................ 271 Compiler errors ................................................................................................................. 271 C Compiler errors .............................................................................................................. 296 Code segment too large ..................................................................................................... 296 Datapass errors .................................................................................................................. 297 Array dimension error ....................................................................................................... 297 Accum Errors .................................................................................................................... 297 Qout Errors ........................................................................................................................ 299 nums ran out early ............................................................................................................. 299
B.3 B.4 B.5
C
Options in the tabulation section ............................................................................ 301 Index ................................................................................................................................ 305
iv / Contents
List of figures 1.1 Simple table of marital status by sex .............................................................................. 1 1.2 Table of marital status by sex filtered by region ............................................................ 3 1.3 Counting respondents who satisfy an arithmetic condition ........................................... 4 1.4 Incrementing cells using values read from the data ....................................................... 5 2.1 Total percentages ......................................................................................................... 33 2.2 Cumulative column percentages .................................................................................. 34 2.3 Indices created with op=8 ............................................................................................ 35 2.4 Table of means ............................................................................................................. 37 3.1 Creating elements with n01 statements ........................................................................ 50 3.2 Table for product tests .................................................................................................. 55 3.3 Using coltxt to print text above/below cell counts ....................................................... 62 3.4 Percentages against nets ............................................................................................... 74 3.5 Percentages against nets and the table base ................................................................. 76 4.1 Creating elements with val ........................................................................................... 90 4.2 Using n00 as a filter in an axis ................................................................................... 104 4.3 Table using inc= ......................................................................................................... 122 5.1 Totals and subtotals .................................................................................................... 135 7.1 Multidimensional table ............................................................................................... 173 7.2 Wide table with squeeze=1 ........................................................................................ 192 7.3 Wide table with squeeze=2 ........................................................................................ 194 7.4 Table with small percentage suppression and T statistics .......................................... 201 8.1 Table titles printed with ttg ........................................................................................ 204 10.1 Grid table .................................................................................................................. 242 10.2 Filtered columns in grid tables ................................................................................. 248 11.1 Tables produced by the sample Quantum job .......................................................... 256
Figures / v
About this guide The Quantum User’s Guide is written primarily for Quantum spec writers. It is also a useful reference for Quanvert database administrators and others who prepare data for use with Quanvert or Quanvert Text. This guide is not intended as a tutorial or teach-yourself document. Instead, it provides a complete and detailed description of the Quantum language and the Quantum programs. However, the guide has been designed with your needs in mind. If you are an experienced user, you will find the Quick Reference boxes at the start of each section helpful as a reminder of syntax. If you are less experienced, you will probably prefer the more detailed explanations and examples in the main body of each section. The Quantum User’s Guide is divided into four volumes, which are described in more detail below. All the volumes contain a comprehensive index that covers all four volumes.
Volume 1, Data editing Volume 1 of the Quantum User’s Guide covers data editing, validation and cleaning: •
Chapters 1 to 3 give you an overview of the language and explain the basic concepts of Quantum spec writing.
•
Chapter 4, ‘Basic Elements’, describes constants, numbers and variables.
•
Chapter 5, ‘Expressions’, describes arithmetic and logical expressions.
•
Chapter 6, ‘How Quantum reads data’, describes types of records, data structure, trailer cards, reserved variables, merging data files and reading non-standard data files.
•
Chapter 7, ‘Writing out data’, describes creating a new data file, copying records to a print file, and writing to a report file.
•
Chapter 8, ‘Changing the contents of a variable’, describes the Quantum assignment statements, adding and deleting codes in a column, forcing single-coded answers, setting a random code in a column, reading numeric codes into an array and clearing variables.
•
Chapter 9, ‘Flow control’, describes the if and else statements, routing around statements, loops, rejecting records, jumping to the tabulation section and canceling the run.
•
Chapter 10, ‘Examining records’, describes holecounts and frequency distributions.
•
Chapter 11, ‘Data validation’, describes the require statement, column and code validation, and validating logical expressions.
About this guide / vii
Quantum User’s Guide Volume 2
•
Chapter 12, ‘Data correction’, describes forced cleaning, on-line data correction, creating clean and dirty data files, correcting data from a corrections file, and missing values in numeric fields.
•
Chapter 13, ‘Using subroutines in the edit’, describes how to call up subroutines, the subroutines in the Quantum library, writing your own subroutines and calling functions from C libraries.
•
Chapter 14, ‘Creating new variables’, describes how to name and define variables in your Quantum spec.
•
Chapter 15, ‘Data-mapped variables’, describes the data-mapped variables feature.
•
Chapter 16, ‘Running Quantum under Unix and DOS’, describes how to compile and run your Quantum program.
Volume 2, Basic tables Volume 2 of the Quantum User’s Guide covers axes and creating basic tables: •
Chapter 1, ‘Introduction to the tabulation section’, provides an introduction to creating tables in Quantum.
•
Chapter 2, ‘The hierarchy of the tabulation section’, describes the components of a tabulation program, the hierarchies of Quantum, how to define run conditions, the options that are available on the a, sectbeg, flt and tab statements, the default options file and some sample tables.
•
Chapter 3, ‘Introduction to axes’, describes how to create an axis, the types of elements within an axis, how to define conditions for an element, the n count creating elements, subheadings, netting and axes within axes.
•
Chapter 4, ‘More about axes’, describes the col, val, fld and bit statements, filtering within an axis, and options on axis elements.
•
Chapter 5, ‘Statistical functions and totals’, describes totals, averages, means, the standard deviation, standard error and error variance statements and how to create percentiles.
•
Chapter 6, ‘Using axes as columns’, describes special considerations for when axes are used for the columns of a table.
•
Chapter 7, ‘Creating tables’, describes the syntax of the tab statement, multidimensional tables, multilingual surveys, combining tables, printing more than one table per page, and suppressing percentages and statistics with small bases.
viii / About this guide
Quantum User’s Guide Volume 2
•
Chapter 8, ‘Table texts’, describes table titles, underlining titles, printing text at the foot of a page, table and page numbers and controlling table justification.
•
Chapter 9, ‘Filtering groups of tables’, describes general filter statements, named filters and nested filter sections.
•
Chapter 10, ‘Include and substitution’, describes filing and retrieving statements, symbolic parameters and grid tables.
•
Chapter 11, ‘A sample Quantum job’, provides an example of a Quantum specification and the tables it produces.
•
Appendix A, ‘Limits’, describes the limits built into Quantum.
•
Appendix B, ‘Error messages’, contains a list of compilation error messages with suggestions as to why you may see them and how to solve the problems which caused them to appear.
•
Appendix C, ‘Options in the tabulation section’, provides a summary of the options available in the tabulation section.
Volume 3, Advanced tables Volume 3 of the Quantum User’s Guide covers advanced tables and statistics: •
Chapter 1, ‘Weighting’, describes the weighting methods that you can use in Quantum.
•
Chapter 2, ‘Row and table manipulation’, describes how to create new rows and tables using previously created tables or parts of previously created tables.
•
Chapter 3, ‘Dealing with hierarchical data’, describes how to use analysis levels in Quantum.
•
Chapter 4, ‘Descriptive statistics’, describes the axis-level and table-level statistical tests that are available in Quantum and provides details of the chi-squared tests, non-parametric tests on frequencies and Friedman’s two-way analysis of variance.
•
Chapter 5, ‘Z, T and F tests’, describe the Z, T and F tests that are available in Quantum.
•
Chapter 6, ‘Other tabulation facilities’, describes how to include C code and edit statements in the tabulation section and how to sort tables.
•
Chapter 7, ‘Special T Statistics’, describes the special T statistics that are available in Quantum.
•
Chapter 8, ‘Creating a table of contents’, describes how to create a formatted list of the tables that are produced by a Quantum run.
About this guide / ix
Quantum User’s Guide Volume 2
•
Chapter 9, ‘Laser printed tables with PostScript’, describes how to convert the standard tabulation output into a file suitable for printing on a PostScript laser printer.
•
Appendix A, ‘Options in the tabulation section’, provides a summary of the options available in the tabulation section.
Volume 4, Administrative functions Volume 4 of the Quantum User’s Guide covers administrative functions: •
Chapter 1, ‘Files used by Quantum’, describes files you may need to create in order to use certain Quantum facilities, including the variables file, the levels file, the default options file, the run definitions file, the merges file, the corrections file, the rim weighting parameters file, and the C subroutine code file, aliases for Quantum statements, customized texts, and userdefinable limits.
•
Chapter 2, ‘Files created by Quantum’, describes many of the files created during a run and draws your attention to those of particular interest.
•
Chapter 3, ‘Quantum Utilities’, describes how to tidy up after a Quantum run and how to check column and code usage.
•
Chapter 4, ‘Data conversion programs’, describes the q2cda and qv2cda programs that convert tables into comma-delimited ASCII format, the qtspss and nqtspss programs that convert Quantum data into SPSS format, and the qtsas and nqtsas programs that convert Quantum data into SAS format.
•
Chapter 5, ‘Preparing a study for Quanvert’, describes the tasks you need to perform before converting a Quantum spec and data file into a Quanvert database.
•
Chapter 6, ‘Files for Quanvert users’, describes files that are specific to either Quanvert Text or Windows-based Quanvert.
•
Chapter 7, ‘Creating and maintaining Quanvert databases’, describes how to create and maintain Quanvert databases.
•
Chapter 8, ‘Transferring databases between machines’, describes how to transfer databases between machines and the programs provided to help you achieve this.
•
Appendix A, ‘Limits’, lists limits built into Quantum.
•
Appendix B, ‘Error messages’, contains a list of compilation error messages with suggestions as to why you may see them and how to solve the problems that cause them to appear.
•
Appendix C, ‘Quantum data format’, describes the Quantum data format.
x / About this guide
Quantum User’s Guide Volume 2
•
Appendix D, ‘Using the extended ASCII character set’, explains how you can use Quantum with data that contains characters in the extended ASCII character set.
•
Appendix E, ‘ASCII to punch code conversion table’, provides a table showing ASCII to punch code conversions.
•
Appendix F, ‘Will this job run on my machine’, offers suggestions on how you can check whether a particularly large job will run on your computer.
Symbols and typographical conventions Words which are keywords in the Quantum language are normally printed in italics in the text. In the main description of each keyword, the keyword is shown in bold the first time it is mentioned. When showing the syntax of a statement, as in the Quick Reference sections, all keywords are printed in bold. Parameters, such as question texts or responses, whose values are user-defined are shown in italics. Optional parameters are enclosed in square brackets, that is, [ ]. All examples are shown in fixed width type. The ✎ symbol marks a note or other point of particular interest. The ☞ symbol marks a reference for further reading related to the current topic.
Comments SPSS MR welcomes any comments you may have about this guide, and any suggestions for ways in
which it could be improved.
About this guide / xi
1 Introduction to the tabulation section When a record has passed through the edit without being rejected, it is passed to the tabulation section, if one exists. At this point, data, integer and real variables are available to create tables. The program deals with one complete record at a time (we’ll ignore trailer card records for the moment).
1.1 Creating tables The tabulation section consists of a series of statements which determine the contents of the tables. Each table may be thought of as a matrix of cells. The table shown in Figure 1.1 below is a 3-by-5 cell table. It consists of three columns (Total, Male and Female) and five rows (Base, Single, Married, Divorced and Widowed) making fifteen cells in all. SPSS MR Sample Table 1 Bread Purchase survey Table 1 Base: All respondents
Page 1 Absolutes
Total Respondents Base (All Resps) Single (c109’1’) Married (c109’2’) Divorced (c109’3’) Widowed (c109’4’)
Male (c106’1’)
Female (c106’2’)
200
44
156
53
15
38
113
23
90
28
3
25
6
3
3
Figure 1.1 Simple table of marital status by sex
Introduction to the tabulation section – Chapter 1 / 1
Quantum User’s Guide Volume 2
Creating the cells of the table Each cell of this table is defined by two conditions, one from the row and one from the column. In this table the conditions which define each row and column are shown in parentheses. They are not, of course, printed in ordinary tables of output. The top left-hand cell contains 200 people. This is everyone in our sample, since the conditions creating this cell are ‘All Respondents’ and ‘Total Respondents’. The middle cell of the top row is defined by the conditions ‘All Respondents’ and ‘Male’, which is the condition that column 106 contains a ‘1’. The total number of male respondents is 44. The second cell in the first column is defined by the two conditions ‘All respondents who are single’ and ‘All respondents’. A single respondent has a ‘1’ in column 109; there are 53 such respondents. The second cell of the third row has the conditions Male (c106’1’) and Married (c109’2’). There are 23 married male respondents. Each time a record passes through the tabulation section, the count in the top left-hand cell is increased by 1, since this cell is to include all respondents. Each time a record comes through in which c106 is a ‘1’, the count in the middle cell of the top row is also incremented by 1 since this cell includes all respondents who are males.
✎ Conditions are positive rather than negative; respondents are included because they fulfil the required conditions rather than being excluded because they do not fulfil them. Many tables contain counts that are created by the existence of more than two conditions. An entire table may be filtered. This means that no one is considered for inclusion in the table at all unless he or she fulfils a condition specified for the table as a whole. For example, we might wish to look at a table which includes only respondents who live in Central London. That condition is c121’1’ which is satisfied by 19 people as shown in Figure 1.2.
2 / Introduction to the tabulation section – Chapter 1
Quantum User’s Guide Volume 2
SPSS MR Sample Table 2 Bread Purchase survey Table 2 Base: All respondents Living in Central London Total Respondents Base (All in C. Ldn) Single (c109’1’) Married (c109’2’) Divorced (c109’3’) Widowed (c109’4’)
Page 2 Absolutes
Male (c106’1’)
Female (c106’2’)
19
1
18
4
0
4
13
0
13
1
0
1
1
1
0
Figure 1.2 Table of marital status by sex filtered by region In the table in Figure 1.2, the count for each cell is defined by three rather than two conditions. The second cell of the third column, for instance, refers to all respondents living in Central London (c121’1’) who are female (c106’2’) and who are single (c109’1’). There are four people in this cell.
Types of data in the cells Many table cells consist of counts created by a series of conditions or filters. As you can see from the examples above, these conditions are created by columns and codes in the general form cn’p’ (for example, c109’1’). There are three other kinds of information that can be used to compute cells in a table: •
First, the conditions can be set up so that every time a record satisfies an arithmetic or numeric condition, the count in the cell is increased by one. You will normally do this when the question on the questionnaire requires a numeric response that will be entered directly into the data as it stands (e.g., age, number of products tried) rather than a response that will be represented in the data file by a specific code (e.g., Green=1, Red=2). In Figure 1.3 we have set up age ranges so that every time a respondent whose age is, say, 45 passes through the tabulation section, the count in the relevant cell is incremented by 1. There are 30 respondents whose ages lie between 45 and 54, six of them men and 24 of them women.
Introduction to the tabulation section – Chapter 1 / 3
Quantum User’s Guide Volume 2
SPSS MR Sample Table 3 Bread Purchase survey Table 3 Base: All respondents
Base 21 - 24 25 - 34 35 - 44 45 - 54 55 - 64 65 and Over
Page3 Absolutes
Total
Male
200 9 59 49 30 35 18
44 2 10 11 6 7 8
Female 156 7 49 38 24 28 10
Figure 1.3 Counting respondents who satisfy an arithmetic condition •
Second, there is arithmetic information itself. In the table in Figure 1.4 the contents of the cells are not counts of individuals fulfilling conditions; in this case, the base is the number of loaves of bread bought by all respondents who bought bread over the period of a month. The figures in the row reading ‘1 – 5 Loaves’ are the total number of loaves bought by those respondents who purchased between 1 and 5 loaves in that month. 94 loaves were purchased during the month by people who bought between 1 and 5 loaves altogether. Tables of this type are generally created when the questionnaire requires the interviewer to write down the exact number the respondent says rather than circling a code representing a range of numbers. When the data is entered on the computer, the columns assigned to this question will contain the exact number the respondent gave — for instance, if he bought 15 loaves of bread, the number 15 will appear in the data rather than, say, a ‘3’ indicating that he bought between 10 and 15 loaves.
•
Third, there are statistical functions such as means. At the bottom of Figure 1.4 we show the mean number of loaves bought per respondent who bought bread.
4 / Introduction to the tabulation section – Chapter 1
Quantum User’s Guide Volume 2
SPSS MR Sample Table 4 Bread Purchase survey Table Base: Number of Loaves Bought Base Total Respondents Who Bought Bread
Page 4 Absolutes Male
Female
190
44
146
2988 94 319 328 427 1266
720 19 33 39 225 291
2268 75 286 289 202 975
Mean Number of Loaves 15.7
16.6
15.5
Number of Loaves Bought Base 1 - 5 Loaves 6 - 10 Loaves 11 - 15 Loaves 16 - 20 Loaves 21 - 25 Loaves
Figure 1.4 Incrementing cells using values read from the data
Table text The text associated with each table is created at various levels of the tabulation program. The text of each specific line (for example, Single, in the first example) is generally written on the same statement that defines the characteristics a respondent must have to be included in that line. Some text, such as the table title, (SPSS MR Sample Table 4, in Figure 1.4) is created at ‘table level’, while some is generated at the ‘run level’ so that it applies to all the tables in the current run. In our sample tables, this is the title ‘Bread Purchase survey’.
Introduction to the tabulation section – Chapter 1 / 5
2 The hierarchy of the tabulation section As was mentioned briefly in the previous chapter, the tabulation section is hierarchical in that characteristics can be defined at one level which will apply to that and all lower levels. The aim of this chapter is to describe those levels and define simply their purpose in the run as a whole as a prelude to the more detailed discussions of the statements themselves in subsequent chapters.
2.1 Components of a tabulation program A tabulation run consists of three sets of control statements: •
Run control statements — these determine the overall characteristics of the run, and contain the text which is constant for all tables. Filters may be defined, applicable either to all tables in the run or to all tables defined before another general filter statement is read. Titles are entered in various ways depending upon their position in the table.
☞ For further information about the run control statement (the a statement), see section 2.3, ‘Defining run conditions’. For further information about the lower level filter statements (sectbeg and flt), see chapter 9, ‘Filtering groups of tables’. For further information about titles and other text statements, see chapter 3, ‘Introduction to axes’, chapter 4, ‘More about axes’ and chapter 8, ‘Table texts’.
•
Table control statements — these name the questions to be cross-tabulated against each other to create tables. In Quantum, these questions are called axes. The most important table control statement is the tab statement which lists the axes to be used to create an individual table. These statements may also specify the text and overall characteristics of each table.
☞ For further information about the tab statement, see chapter 7, ‘Creating tables’. •
Axis control statements — broadly speaking, these are Quantum’s way of defining questions from the questionnaire. Each axis consists of a set of statements which establish the conditions and text for the rows and columns of a table. The two axes used to create the table shown in Figure 1.1 were sex for the columns and mstat (Marital Status) for the rows.
☞ For further information about axis control statements, see chapter 3, ‘Introduction to axes’ and chapter 4, ‘More about axes’.
The hierarchy of the tabulation section – Chapter 2 / 7
Quantum User’s Guide Volume 2
2.2 Hierarchies of Quantum Quantum’s tabulation section consists of a series of levels, beginning with the lowest level, the line, and progressing upwards to the entire run. Within each of these hierarchical levels, conditions and characteristics can be specified for the current (and sometimes lower) level. In many instances, characteristics specified at a higher level can be overridden by characteristics specified at a lower level. For instance, the cells in a line can consist of absolute figures, column percentages or row percentages, to name but a few. An option on the first run control statement (the a statement) can cause all cells in all tables in the run to contain absolute figures. The same option placed at the next level down (the tab statement) may state that the cells in this particular table only will show, say, column percentages. This option overrides the option on the a statement for this table only. At the lowest level, the option on the a or tab statement can be overridden by an option on the statement creating a single line (i.e., an n, col, val, bit or fld statement). The option might specify that the line created by this statement will display absolute figures only rather than absolutes and column percentages. These hierarchies greatly increase the flexibility of the tabulation program. However, they do mean that you must pay attention to what level you are on otherwise you may not get the results you expect.
2.3 Defining run conditions Quick Reference To define global and default conditions for the run, type: a;opt1[; opt2; ... ] at the start of the tabulation section.
Global run conditions, if any, are defined on the a statement. If used, it must be the first statement in the tabulation section. Its format is: a;options where options are keywords defining the global characteristics of the run. You can use as many keywords as you like and you can list them in any order, but you must separate them with semicolons (;), for example: a;dsp;op=12;date;dec=1
8 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
This statement tells Quantum that all rows will be double-spaced (dsp), cells will contain absolute figures and column percentages (op=12), the date will be printed on each table (date) and absolutes will be shown to one decimal place (dec=1). These and all other options are described below. Most options which are valid on the a statement are also valid on sectbeg, flt or tab statements. In this chapter, unless an option’s description specifically states that the option is not valid on particular statements, you may assume that the option is valid on a, sectbeg, flt and tab statements. Where a keyword appears on two or more of these statements, the setting at the lower level will override the setting at the higher level for that table or group of tables only. For example, if the same option is present with different values on a flt and a tab statement, the option on the tab will override the option on the flt for that table only. Similarly, where an option is present on both the a statement and a flt, the option on the a statement will be overridden by the option on the flt until another flt is read.
☞ For further information about this concept of overriding options, see section 7.2, ‘Options on the tab statement’ and section 9.2, ‘Named filters’.
Options on a, sectbeg, flt and tab statements Options can be divided into two categories: output options and data options. The former determine the format of each table in the run, but have nothing to do with the numbers in each cell, whereas the latter determine how the cell counts are to be created but have nothing to do with the overall appearance of the tables. Jobs in which only the output options have been changed can be rerun without rereading the data, but jobs in which data options have been altered must be rerun just as if they were new jobs.
☞ For further information on running Quantum, see chapter 16, ‘Running Quantum under Unix and DOS’ in the Quantum User’s Guide Volume 1.
The hierarchy of the tabulation section – Chapter 2 / 9
Quantum User’s Guide Volume 2
Output options Output options are those which affect the way your tables are formatted and printed. They do not determine how the data is tabulated or how the individual cell counts are calculated. Unless otherwise stated, all options are valid on a, sectbeg, flt and tab statements. acr100
This prints the text ‘100%’ on each cell of the base column when row percentages are requested with op=0. Normally, a base column contains absolute figures only. If acr100 is used without row percentages, it is ignored.
anlev=
Defines the analysis level at which axes are to be cross-tabulated in a hierarchical (trailer card) job.
☞ For further information about analysis levels, see chapter 3, ‘Dealing with hierarchical data’ in the Quantum User’s Guide Volume 3. axttx
This option creates table titles of the form ‘axis name by axis name’. x can be l (lowercase L) for a title printed in the left, c for a title printed in the center of the line, r for a title on the right, or a number between 1 and 9 to have the title indented by ten times that amount of spaces. For instance axtt5 will indent the title by 50 spaces. You may also type axttg to have the start of the title lined up with the start of the column headings.
baft
This keyword causes any table titles starting with the word ‘Base’ to be printed after all other titles for that table. If the keyword base appears on a ttbeg/ttend/ttord statement and baft is also used, an error message is generated.
✎ Do not use baft with ttbeg=base since the two are incompatible. colwid=n
Defines the width of columns in the printed tables where no p statements exist in the column axis.
☞ For a full discussion about creating column headings, see section 6.5, ‘Manual set-up’. csort
Sort tables column-wise (i.e., horizontal sorting rather than vertical row-wise sorting).
date
By default, tables are printed without a date. Use of the keyword date causes the current date to be printed in the top right-hand corner of each table. The date is in the format dd mmm yy; for example, 3 OCT 00.
dec=n
This determines the number of decimal places for absolute figures. If dec= is not used, the default of no decimal places is assumed.
10 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
decp=n
This sets the number of decimal places required for percentages. The default is decp=1 meaning one decimal place. This applies when op=0, 2, 7 or & (see below). Any number of decimal places are allowed, as long as you make each column wide enough to accommodate them.
✎ Remember that Quantum’s calculations are accurate to six digits only. dsp
This leaves one blank line between each row of data in a table. Without this, one line follows directly underneath another.
flt=name
Invokes the filter conditions and titles named on the flt= statement. If the filter defines conditions, the rules governing data options apply. This option is valid on sectbeg, flt and tab statements, but not on the a statement.
☞ For information on the flt= statement, see section 9.2, ‘Named filters’. flush
Causes rows containing percentages to be printed with the percentages directly below the absolutes rather than one column to the right. Let’s say that a column contains an absolute figure of 39 which is 15.1% of the total. Here is the difference in the output between using and not using flush: 39 15.1% With flush
39 15.1% Without flush
As you can see, flush prints the right-most digits of the absolute and percentage figures one under the other; it does not print the percentage sign underneath the absolute number. Where further adjustments are necessary, use pcpos= as described later in this section. font=(ttype=fnum, ... ) You use this keyword when you want your tables to be printed in PostScript on a laser printer. font= defines the fonts in which various types of output are to be printed. Fonts are entered in the format shown above where ttype defines the text type and fnum is the number of the font (between 0 and 9) to be used for that text. Fonts and the numbers which represent them are defined on a per site basis: your system administrator will know what they are. Text types are: def
default font
a
text following the a statement
bot
text following bot statements
foot
text following foot statements
flt
text following flt statements
The hierarchy of the tabulation section – Chapter 2 / 11
Quantum User’s Guide Volume 2
tab
text following tab statements
tb
table numbers
sidett
titles after the row l statement
toptt
titles after the column l statement
stub
row element texts
text
n03 and n23 texts
banner
g statement / column n01 texts
numb
all numbers
pc
all percentages
colpc
column percentages
rowpc
row percentages
stats
statistical row texts and numbers
page
page text and numbers
type
output type text
date
the date
Text for which no font is defined is automatically printed in the standard laser printing font. If most of the table is to be printed in the same font, you may define this font as the default font (using the text type def=). However, if this option is used, it must precede all other options. Similarly, you may use the option pc to define a font for all percentage figures, but if you then wish to have row and/or column percentages in yet another font, the options rowpc and/or colpc must follow pc otherwise they will be overridden by the more general percentage font. Let’s say that we have three fonts; 1 is standard type, 2 is bold and 3 is italic. We wish to have all run level titles (that is, those following the a statement) printed in a bold font and all percentages in italics. We would write: a;font=(a=2,pc=3)
All other texts are printed in font number 1, the standard font. Because of the way in which Quantum stores the font changes, tables to be laser printed must have a page width of 132 or 158 characters defined on the a statement. Do not use font= if you do not want to use PostScript printing because it causes the font numbers to be printed on the right side of the tab_ file.
☞ For further information about laser printing, see chapter 9, ‘Laser printed tables with PostScript’ in the Quantum User’s Guide Volume 3.
12 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
graph=
Produces SYLK format files for use with graphics or spreadsheet packages which read this type of files (for example, Chart, Graphwriter for graphics and Symphony for spreadsheet applications). A separate file is created for each table containing the statements necessary to reproduce the table as a 2-dimensional bar chart. By default, Quantum removes all base elements and only saves absolute figures. Table title are created from the row axis according to the hierarchy hd=, ttl, n23 using the first title found. If none of these types of title exists, a title of the form ‘row axis by column axis’ is generated, as in the axtt option. You may override any or all of these defaults by using the parameters listed below: rb
show row base figures.
cb
show column base figures.
pc
show percentages only. Where tables are created with more than one type of percentage, the priority is column then row then total percents.
text
graph title.
☞ For further information on graphics files, see chapter 2, ‘Files created by Quantum’ in the Quantum User’s Guide Volume 4. hitch=
Prints the current table on the same page as the previous table if there is room for the whole table on the page. If the current table has more than one page, Quantum prints its first page on the same page as the previous table.
☞ For further information, see section 7.6, ‘Printing more than one table per page’. indent=n
Where a row text is longer than the space allocated to the row text in the table, Quantum breaks the line in between words and continues the text on the next line. To have these continuation lines indented from the left margin, specify the amount of indentation required with indent=. Texts may be indented by between 0 and 15 spaces: the default is indent=0.
lang=xxx
This is only valid on a and tab statements: •
On the a statement, it specifies that this is a multilingual survey and xxx is the one to three character code of the default language.
•
On the tab statement, xxx specifies the language in which axis texts are to be printed.
When used on a tab statement, the default language must be specified on the a statement.
☞ For further information, see section 7.3, ‘Multilingual surveys’.
The hierarchy of the tabulation section – Chapter 2 / 13
Quantum User’s Guide Volume 2
linesaft=
Defines the number of blank lines to print after the last line of column headings. The default is one blank line.
linesbef=
Defines the number of blank lines to print before the first line of column headings. The default is two blank lines.
manipz
Apply spechar, nz, nzrow and nzcol to elements created using manipulation.
☞ For information on manipulating elements and tables, see chapter 2, ‘Row and table manipulation’ in the Quantum User’s Guide Volume 3. netsm
Indicates that suppressed elements should be collected into an element flagged with smsup+ only if that element is at the same level as the suppressed elements. For example, if an element at net level 2 is suppressed because its cell counts are below a given value, that element will only be included in the table if there is an element with smsup+ at level 2 into which it can be added. Without netsm, suppressed elements will be added into the next smsup+ element regardless of whether it is at the correct level. Thus, an smsup+ element at level 2 may contain elements at level 2 and also any previously suppressed elements from level 1.
☞ For an example and a more detailed explanation, see ‘Accumulation of suppressed elements by net level’ in chapter 3, ‘Introduction to axes’. netsort
This statement is valid on a and l statements only. Requests that nets defined with the net statement should be sorted according to their net level. This means that nets at level 1 will be sorted and, within them, nets at level 2, and so on. Elements within a net are also sorted. When netsort is used, each level below level 1 will be indented by 2 spaces per level — thus nets at level 2 are indented by 2 spaces (1×2 spaces); nets at level 3 are indented by 4 spaces (2×2 spaces). The elements comprising a net are indented by an additional two spaces. The number of spaces indentation can be varied using netsort=n, where n is a whole number in the range 1 to 9, and is the number of spaces by which to indent. For example, netsort=3 will indent by multiples of 3 spaces. If a global indentation is set for all sorted tables of nets in the run, it may be turned off for an individual table by entering nonetsort or netsort=0 on the l statement for the table’s row axis.
14 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
✎ For netsort to work, the keyword sort must be present on the same statement as netsort or on a statement at a higher level. For example, to sort the nets in a single table, place netsort on the l statement of the row axis and sort on the a, sectbeg, flt or tab statement.
☞ For examples of nets and sorted nets, see section 3.6, ‘Netting’ in this volume and section 6.3, ‘Sorting tables’ in the Quantum User’s Guide Volume 3. For more details about subsorts, see ‘Sorting with subsort and endsort’ in chapter 6, ‘Other tabulation facilities’ in the Quantum User’s Guide Volume 3. nooverlapfoot Suppress the footnote that is automatically printed on tables with special T-statistics run on overlapping data.
☞ For further information, see section 7.8, ‘Overlapping data’ in the Quantum User’s Guide Volume 3. noprint
Suppresses the printing of a table.
notauto
Suppresses the automatic footnotes that describe which special T-statistics have been applied to a table.
☞ For further information, see ‘Suppressing footnotes’ in chapter 7, ‘Special T statistics’ in the Quantum User’s Guide Volume 3. notbl
Suppresses table numbers requested with tbl or tbr statements.
nzcol
Suppresses the printing of columns where all cells are zero or round to zero. When columns are suppressed in an axis whose column headings are defined on g statements, Quantum ignores the g statements and creates its own column headings using the texts defined on the elements themselves.
☞ For a description of how to create column headings with g statements, see chapter 6, ‘Using axes as columns’. nzrow
Suppresses the printing of rows where all cells are zero or round to zero.
op=n
This keyword governs the type of output in the tables. Output types are: &
Total percentages. The value in the cell is percentaged against the number in the upper left-hand corner of the table (normally the base) rather than on the totals in the relevant column or row. If the table contains more than one base element, percentages are calculated using the leftmost figure in the most recent base element.
The hierarchy of the tabulation section – Chapter 2 / 15
Quantum User’s Guide Volume 2
–
Row rank figures are printed below each cell. Figures are ranked within rows, using 1 for the largest figure. Where two or more numbers have the same rank, they are all assigned the lowest rank possible. Thus, if the previous rank was 2 and the next value to be ranked occurs in the row three times, those numbers will all be ranked 5.
✎ You may not request row and column ranks in the same table. 0
Row percentages.
1
Absolute figures (default).
2
Column percentages.
3
Column rank figures are printed below each cell. Figures are ranked within columns, using 1 for the largest figure. Where two or more numbers have the same rank, they are all assigned the lowest rank possible. Thus, if the previous rank was 2 and the next value to be ranked occurs in the column three times, those numbers will all be ranked 5.
✎ You may not request row and column ranks in the same table. 5
Prints the text ‘100%’ on each cell of the base row.
6
Used with op=2 to produce two percentages for each cell. The first is the percentage of the cell against a redefined base, and the second is the percentage of the cell against the first base in the axis. You might use this when you have a table showing which of two products people preferred, and their reasons for preferring this product. Percentages could be calculated against a redefined base such as ‘All preferring Brand A’. and then against the first base (all respondents).
☞ For an example, see section 3.6, ‘Netting’. 7
Cumulative percentages.
8
Indices. The index for a cell is generated by dividing the row percentage in the cell by the row percentage in the base row. If the table contains more than one base row, indices are calculated using the row percentage in the most recent base row. It shows you how closely the percentages in the current row reflect those in the base row. The nearer the index is to 100%, the more closely the current row mirrors the base row.
16 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
9
Prints absolutes and percentages side by side. Four columns are allocated to the percentage if it has no decimal places; percentages with decimal places are allocated 5+decp columns (for example, seven columns for percentages with decp=2). When a cell contains absolutes and percentages and op=9 is not used, the absolute figure is printed on the top line with the column and row percentages on the second and third lines respectively.
94 This is a variation of op=9 which allocates three columns to percentages with no decimal places, and 4+decp columns where there are one or more decimal places. This can be useful for tables with very wide column axes where no column contains 100%. When you create a table with more than one output type, Quantum prints the different values one under the other in each cell. If you’d prefer to have a separate table created for each output type (e.g., absolutes and column percentages as separate tables rather than both on the same table), enter the letter s in upper or lower case between the equals sign and the list of output types. For example: op=S012
creates three tables, one of absolutes (1), one of column percentages (2) and one of row percentages (0). There is no significance in the order in which you list output types with op=. Quantum always prints them in the order shown below. 1 2 6 0 & 8 –/3
Absolutes Col percentage on current base Col percentage on first base Row percentage Total percentage Indices Row or column ranks Absolutes for tables of means/proportions (Quantum only) Proportions (Quanvert only) Means (Quanvert only) Statistical probabilities Statistical flags Percentage differences
Thus, although the example above specifies output types in the order row percentages (0), absolutes (1) and column percentages (2), the first page will show absolutes only, the second page will show column percentages only and the third page will show row percentages only.
The hierarchy of the tabulation section – Chapter 2 / 17
Quantum User’s Guide Volume 2
The exception is when you want Quantum to calculate percentage differences. In this case, the difference is calculated using the last percentage type named with op=. For example, column percentages if op=012 is used.
✎ Examples of tables containing some of these type of output can be found in section 2.5, ‘Sample tables’.
☞ For information on percentage differences, see section 4.9, ‘Percentage differences’. page
This option invokes automatic page numbering. Since this is the default — pages are numbered from 1 automatically — this option is generally used in its negative form of nopage which suppresses automatic page numbering.
paglen=n
This determines the number of lines printed on each page. The default is paglen=60 lines but any value between 10 and 10,000 is valid.
pagwid=n
Normally tables can be up to 132 characters wide. pagwid= enables you to decrease the page width or to extend it to a maximum of 10,000 characters.
✎ If your job uses a variety of page widths, you must ensure that the largest one is defined on the a statement. Additionally, if you will be laser printing tables using the font= option, the tables may be 132 or 158 characters wide only. pc
This prints percent signs after percentage figures. This is the default, so this option is usually used negatively — nopc — to print percentage figures without percent signs.
pcpos=[±]n
When Quantum prints percentages underneath absolutes, it offsets the percentages by one column to the right of the absolutes. pcpos= is an extension of flush, provided so that you may determine more precisely where percentages are printed in relation to absolutes. The number of columns to offset is defined by indicating the position of the rightmost digit of the percentage in relation to the right-most digit of the corresponding absolute figure. Offsets of up to ±7 characters are valid. A negative value indicates positioning to the left of the absolute, while a positive value indicates positioning to the right. The default is pcpos=1 which has the same effect as noflush; pcpos=0 is the same as flush. Here is a brief example to illustrate the effect of pcpos: 39 15.1% pcpos=1 (default)
pcsort
39 15.1% pcpos=0 (same as flush)
Sort on percentages rather than absolutes.
18 / The hierarchy of the tabulation section – Chapter 2
39 15.1% pcpos=-1
Quantum User’s Guide Volume 2
pczerona
✎
Prints ‘NA’ instead of ‘0.0’ as the percentage in cells which have a zero base.
NA is printed in the
same position as the decimal part of the percentage. By default this is one character to the right of the absolute value.
physpag
Specifies that physical, rather than logical, page numbers are printed when using hitch and squeeze.
☞ For further information, see section 7.6, ‘Printing more than one table per page’. printz
This prints tables in which all cells are zero. Normally such tables are suppressed.
rinc
Indicates that when a table is both too long and too wide to fit on one page, rows should take precedence over columns when the table is paginated. This means that Quantum will print all the rows on as many pages as necessary with the left-hand side of the column headings before repeating the process for the right-hand side of the column headings.
☞ For further details, see ‘Automatic pagination’ in chapter 4, ‘More about axes’. round
Force row and column percentages to round to 100%. This option works only with op=2 and op=0 and is ignored for op=6 and op=&. All op= options on the elements of an axis are ignored for rounding purposes. The option noround may be used on elements which may be totaled, (e.g., n01) to prevent them being altered in any way by the rounding process. n15 and n25 statements and nets are automatically assigned the default of noround. When deciding which percentages may be altered to force the row and/or column percentages to round to 100%, Quantum adds up the absolute values in the relevant rows and/or columns (between bases if there are several bases). It then compares the result with the absolute value in the base. If both numbers are integers, and they are the same, forcing can be done, but excludes elements with the noround option. If both are integers and they differ, no forcing is done. If either the base or the sum of the absolutes is not an integer, and the values are the same to within one part in 1,000, forcing can be done. As noted above, elements with the noround option are not affected by the rounding process.
The hierarchy of the tabulation section – Chapter 2 / 19
Quantum User’s Guide Volume 2
If rounding may be done, Quantum finds the largest absolute and alters the corresponding percentage so that the sum of all percentages is 100%. Quantum chooses the largest absolute because changing the percentage for this figure will cause least distortion to the original percentages. If several elements have the same largest value, Quantum changes the percentage for the first of those elements and leaves the others untouched. The decisions on whether or not rounding may take place, and which value to round, are based on the values with all the decimal places that Quantum holds for them, not just the values you see printed in the table. rsort
Sort tables row-wise (that is, vertical sorting rather than horizontal row-wise sorting). This is the default.
side=n
This option can be used to alter the row text width. The default is side=24 and the maximum side text width is 120 characters.
smallbase=
Defines the value below which bases are to be marked as small bases in tables with special T statistics.
☞ For further information, see section 7.5, ‘The base for T statistics’ in the Quantum User’s Guide Volume 3. smbase=
Suppresses percentages, means, standard deviations, standard errors and sample (error) variances in a cell if the base for the percentage or statistic is less than the given figure. Use with smrow to suppress row percentages or with smcol to suppress all other types of percentage.
☞ For further information, see section 7.7, ‘Suppressing percentages and statistics with small bases’. smcol
Indicates that values defined with smsupa/smsupp/smsupt refer to columns. When columns are suppressed in an axis whose column headings are defined on g statements, Quantum ignores the g statements and creates its own column headings using the texts defined on the elements themselves.
☞ For further information about column headings and g statements, see chapter 6, ‘Using axes as columns’. smflag=n
When statistical tests are carried out on cells with small bases, the percentages in those cells may appear to be significant when they are not. smflag= enables you to determine what constitutes a small base and to flag cells with that base when the table is printed.
20 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
n is an integer or real value which determines the maximum size of a ‘small’ base. When a table containing row, column and/or total percentages is printed, Quantum will print the letter ‘s’ to the right of any cell in which the unweighted base in the appropriate direction (e.g. column base for column percentages) is smaller than n. smrow
Indicates that values defined with smsupa/smsupp/smsupt refer to rows. This is the default.
smsupa=n
Suppresses any element in which all absolutes are below the given value. Use with smrow to suppress rows and/or smcol to suppress columns. If all elements in a table are suppressed, the table itself is suppressed. You can therefore use this option to suppress tables in which the base is less than a value of your choice.
smsupp=n
(or smsupc=n). With smrow, suppresses any row in which all column percentages are below the given value. With smcol, suppresses any columns in which all row percentages are below the given value. If all elements in a table are suppressed, the table itself is suppressed.
smsupt=n
Suppresses any element in which all total percentages are below the given value. Use with smrow to suppress rows and/or smcol to suppress columns. If all elements in a table are suppressed, the table itself is suppressed.
smtot
Used with one of the smsup options to suppress rows in which the leftmost base value is less than the value given with smsup. Without smtot, all values in the row are compared against the smsup value.
sort
Creates sorted or ranked tables.
☞ For further information about sorting, see section 6.3, ‘Sorting tables’ in the Quantum User’s Guide Volume 3. spechar=ab
When a cell in a table is zero or would round to zero, you may wish to have specific characters or blanks printed in the cell in place of the zeros. spechar (short for ‘special characters’) makes this possible. The first character (a) is placed in cells which have true zero values, while values which round to zero are replaced with the second character (b). The special characters may be any non-numeric character or blank. If either character is blank, enclose the pair of characters in double quotes. For example: spechar=" *"
sets blank as the character for values which are truly zero.
The hierarchy of the tabulation section – Chapter 2 / 21
Quantum User’s Guide Volume 2
✎ Quantum differentiates between means and other statistics, such as standard deviation, in which the sum of values is zero, and those in which the sum of cases (respondents) is zero. Quantum only prints the special character if the number of cases going into the mean is zero. Thus, 0/3 is always printed as zero, whereas 0/0 will be printed as the special character for zero if one is defined. Zero values generated as the result of manipulation are always printed as such and are never replaced with a special character. squeeze=
Prints as many pages of the current table as possible on the same page.
☞ For further information, see section 7.6, ‘Printing more than one table per page’. tabcent
Center tables within the page width.
✎ Tables formatted with the postprocessor pstab for printing on a PostScript printer are automatically centered within the page width.
☞ For further information on pstab, see section 9.1, ‘Printing output with pstab’ in the Quantum User’s Guide Volume 3. title
Creates left-justified table titles of the form ‘row by column’ from the axis titles defined with hd= on the row and column l statements. For example, if the axes age and sex are introduced by the statements: l age;hd=Age of Respondent l sex;hd=Sex of Respondent
the table title will be ‘Age of Respondent by Sex of Respondent’. topc
Prints a percent sign at the top of each column of the table. This option is only valid if you use nopc (don’t print percent signs after percentages) and op=2 (print column percentages) together and op=1, op=3 or op=8 are not present.
tstatdebug
Prints the intermediate figures for all special T statistics in a run. You may use this option instead of placing debug on every tstat statement.
☞ For further information, see chapter 7, ‘Special T statistics’ in the Quantum User’s Guide Volume 3.
22 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
ttbeg=(text,text, ... ) Quantum normally prints titles in the following order: • • • • • • •
table number higher (3+) dimension texts texts following column l statements texts following row l statements texts following tab statements texts following flt statements texts following flt= statements
If you are generally happy with this order but there are one or two titles that you want to print first rather than in their default positions, specify just those titles with ttbeg=. Quantum will then print those titles first, in the order you list them with ttbeg=, and then all other types of titles in their default order. Each type of title has its own keyword: tb table number high higher (3+) dimension texts top texts following column l statements side texts following row l statements tab texts following tab statements flt texts following flt statements nflt texts following flt= statements To specify titles, enter the appropriate keywords inside the parentheses in the order you want those titles printed, and separate them with commas. Titles starting with the word Base are usually positioned according to the type of statement they follow. By using the keyword base with ttbeg= you may determine more specifically where such texts are printed. Therefore, to print texts following flt statements first, texts following tab statements next, and with all texts starting with Base underneath you would write: a;ttbeg=(flt,tab,base)
Any other titles would be printed below the base texts in the order tb, high, top, side, nflt.
✎ Using ttbeg=base with baft generates an error message since the two are incompatible.
The hierarchy of the tabulation section – Chapter 2 / 23
Quantum User’s Guide Volume 2
ttend=(text,text, ... ) This is the opposite of ttbeg because it defines those titles which are to be printed at the end of the list of table titles. Keywords are as described for ttbeg=. You would normally use ttend when you are generally happy with the order in which Quantum prints titles, but there is one particular type of title that you always want to print last rather than in its default position. If baft is also present in the program, it is imputed as ttend=base after all other ttends, although if base is present on the ttend= an error will occur. ttord=(text,text, ... ) This defines the order in which table titles are to printed. You use it when you want to specify your own order for titles, and to have this order override completely the default order that Quantum normally uses. Conventions are as described for ttbeg=, except that the top parameter is not valid with ttord. If your list omits some of the titles that Quantum normally prints, these titles will not be printed. For example, if you type: ttord=(tb,tab)
your tables will have a table number and any titles defined with tt statements under tab statements. Titles defined in any other place (under the l statement, for example) will never be printed. type
Prints the output type (for example, Absolutes, Column Percents) in the top righthand corner of the table. This is the default, but notype may be used instead to suppress printing.
24 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
Data options Data options are options which determine how the numbers in the tables will be calculated. They have nothing to do with the way those values are subsequently printed. Unless otherwise stated, all options are valid on a, sectbeg, flt and tab statements. axcount
This keyword requests a summary of the records present in each axis. For each axis, Quantum reports the axis name, the number of records which were excluded from the axis because they failed the condition on the l statement, the number of blank records (i.e., those with no responses to any of the totalizable elements), and the number of records which had at least one code in a totalizable element. For this group of records, a further breakdown shows the number of records with 1 code, 2 codes, and 3+ codes. The report is printed at the end of out2, just before the counts of records accepted and rejected. Axes are sorted in alphabetical order, and in levels jobs, within level. For example: Axis Skipped ax01 ax02 ax03 ax04 7
Blank 4 8 4 -
Coded 96 92 96 93
1 code 26 27 22 17
2 codes 3+ codes 38 32 31 34 44 30 49 27
In this example, all records are eligible for inclusion in ax01: 4 are blank and 96 are coded. Of those, 26 are single-coded, 38 have 2 codes and 32 have 3 or more codes. In ax04, 7 records skip this axis because they fail the condition on the l statement. The remaining 93 records are all coded. axreq=
This allows an axis to be used to edit the data and report on whether the record fulfilled the conditions within the axis. The type of coding required within the axis is defined as follows: none no requirements (default) sc single-coded scb single-coded or blank nb not blank If a record fails the condition on the l statement, then the checks for type of coding are ignored. In all other cases, the checks are made, and any records failing the requirement are written to out2 with an explanatory message, as for require statements in the edit. Lines are also appended to the summary at the end of the print file, out2, and to the summary file, sum_, reporting the number and percentage of records failing each type of condition.
The hierarchy of the tabulation section – Chapter 2 / 25
Quantum User’s Guide Volume 2
For example, the axes: l sex;axreq=sc col 7;Base;hd=Sex;Male;Female l prefer;axreq=scb col 15;Base;hd=Brand Preferred;Brand A;Brand B; +Brand C; ... l tried;axreq=nb col 22;Base;hd=Brands Tried;Brand A;Brand B; +Brand C; ...
produce: 60 in file ----+----1----+----2----+ .... Columns 101-200 are |006110*3116162*101001 14 ... not single-coded in axis sex multi-coded in axis prefer blank in axis tried
in out2, and the lines: 1 ( 1 ( 1 (
1%) not single-coded in axis sex 1%) multi-coded in axis prefer 1%) blank in axis tried
at the end of the print and summary files.
✎ axreq= merely reports records with incorrect coding; it does not reject them from the axis or from tables using that axis. c=logical_expression This defines conditions which a record must satisfy if it is to be included in the tables. Conditions may be any valid logical expression. The option c= is most frequently used when creating rows and columns.
☞ For information about logical expressions, see section 5.2, ‘Logical expressions’ in the Quantum User’s Guide Volume 1. For information about c=, see section 3.3, ‘Defining conditions for an element’ in this volume. clevel=
This specifies a global confidence level for all tests in the Quantum run.
☞ For details about requesting T-tests and setting confidence levels, see section 7.7, ‘Requesting a test’ in the Quantum User’s Guide Volume 3.
26 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
dp
This statement is only valid on the a statement. Calculate cell values in double precision. The default is single precision. Double precision produces more accurate results when you are working with very large numbers or numbers with many decimal places. It also increases the time taken to run your job. For these reasons you should think carefully before using this option unnecessarily. Only the cell calculation (accum) and output (qout) stages of a Quantum run work in double precision. The values in the cell counts (nums) file are always written in single precision. Numbers held in single precision are only ever precise to six digits. If accum calculates a number as being 1234.56789, it will write the number out to the nums file as 1234.56???, where ? is unpredictable. The same is true of 1234567890 which becomes 123456????. If you have to deal with very large numbers, you are advised to reduce the number of significant figures by scaling the numbers down by 1,000 or 10,000 so that the printed output has a higher level of accuracy. You can add a title to the table explaining the scaling factor applied.
inc=arithmetic_expression This causes the cell counts in a table to be incremented by the value of an arithmetic expression, rather than by 1, for each respondent included in that cell.
☞ For more information about inc=, see ‘Data options’ in chapter 4, ‘More about axes’. inctext=description_text Can be used with the inc= option to specify a description text for a numeric variable. When a numeric variable appears many times in the program, Quantum only uses the first inctext= associated with the variable. However Quantum issues a warning on the screen and in out1 if the text on subsequent inctext= statements differs from that on the first statement. This test is case-sensitive, so Quantum issues a warning if the first text is ‘Serial number’ and the second is ‘serial number’. If no inctext= is specified for an inc=, Quantum generates a description text that matches the specified name. If inctext= is specified on a statement with no inc=, it is ignored with a warning message. inctext= is not valid for elements of grid axes, nor for pre= or post= options on wm statements.
The hierarchy of the tabulation section – Chapter 2 / 27
Quantum User’s Guide Volume 2
✎ You define numeric variables for use in Quanvert databases and for export to SPSS or SAS with the namedinc statement.
☞ For information on using namedinc when exporting to
SPSS or SAS, see chapter 4, ‘Data conversion programs’ in the Quantum User’s Guide Volume 4. For information on using namedinc when setting up a Quanvert Database, see chapter 5, ‘Preparing a study for Quanvert’ in the Quantum User’s Guide Volume 4.
maxim
Produces tables in which cells are the maximum values of inc= variables. Means that are zero are omitted from the calculation.
☞ For an example of a table of means, which is similar to a table of maximum values, see ‘Table of means’ later in this chapter. means
Produces tables in which cells are the mean values of inc= variables.
☞ For an example, see ‘Table of means’ later in this chapter. median
Creates a median element using real values read from the data using inc=
☞ For further information on how to create percentiles, see section 5.7, ‘Creating percentiles and medians’. medint=n
Determines the interpolation method to be used when percentiles and medians are created using values read from numeric variables in the data file. That is, those specified on an n01 statement with inc= and the percentile= keyword. Where n is the interpolation method. Values of n are: 0
Interpolate between the value that goes over the percentile mark and the previous value. For example, if calculating the median, this would interpolate between the value that goes over the 50% mark and the previous value. Theoretically, this means that the values are being treated as the high boundaries of intervals. This is the default.
1
No interpolation. Return the exact value that went over the percentile mark. If a value goes precisely to the percentile mark, the percentile is the midpoint between that value and the next value.
2
Interpolate between •
the midpoint between the percentile mark and the previous value, and
•
the midpoint between the percentile mark and the next value
This corresponds to values being treated as the midpoints of intervals.
28 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
3
Interpolate between the percentile mark and the next value. This corresponds to values being the low points of intervals.
☞ For information on how to create percentiles and medians and further details on the interpolation methods, see section 5.7, ‘Creating percentiles and medians’. minbase=n
Defines the minimum size of the effective base for T statistics. If the effective base is less than n, the tests are not carried out.
☞ For further information, see section 7.5, ‘The base for T statistics’ in the Quantum User’s Guide Volume 3. minim
Produces tables in which cells are the minimum values of inc= variables. Means that are zero are omitted from the calculation.
☞ For an example of a table of means, which is similar to a table of minimum values, see ‘Table of means’ later in this chapter. missingincs
Switches on missing values processing in the tabulation section. This provides the following facilities: •
Automatic replacement of missing values with missing_.
•
Automatic exclusion of missing values from elements created using inc=.
•
A missing= option for defining other values that are to be treated as missing values.
•
A missing_ condition on val statements to count records with missing values.
•
An ismissing function to check whether a variable has the special value missing_.
In addition, the missingval keyword is provided for exporting missing values as missing_ rather than with their element numbers. Quantum honors this keyword at all times whether or not missing values processing is switched on.
✎ If the run has an edit section and missing values processing is switched on in the edit, this setting carries through to the tab section. If you want missing values processing in the edit but not in the tab section, you must remember to switch it off with a missingincs 0 statement at the end of the edit.
☞ For an explanation of what missing values are and when they occur, see section 12.6, ‘Missing values in numeric fields’ in the Quantum User’s Guide Volume 1.
The hierarchy of the tabulation section – Chapter 2 / 29
Quantum User’s Guide Volume 2
missing=logical expression Treat any record that satisfies the logical expression as a record with a missing value. This option is normally used with inc=.
☞ For further information, see the notes on inc= in ‘Data options’ in chapter 4, ‘More about axes’. nsw
Causes the compiler to insert a squared weighting statement after each base element in every axis and before every n12. This is required when running special T statistics on weighted tables.
☞ For further information, see section 7.3, ‘T statistics on weighted tables’ in the Quantum User’s Guide Volume 3. overlap
Causes Quantum to calculate T statistics using a formula that takes into account the fact that a respondent may be present in more than one of the elements being tested.
☞ For further information, see section 7.8, ‘Overlapping data’ in the Quantum User’s Guide Volume 3. percentile=n
Creates a percentile element using real values read from the data using inc=. Where n specifies the percentile to be calculated, for example, type percentile=25 to create a quartile element.
☞ For further information on how to create percentiles, see section 5.7, ‘Creating percentiles and medians’. scale=[/]n
This option defines a scaling factor by which all cells in a table will by multiplied (scale=n) or divided (scale=/n), including statistical elements. For example, if you have a table reporting the number of gallons bought, you can convert these counts to liters by including the option scale=4.55 on the tab statement. If statistical elements are not to be scaled, the option must be switched off individually for each element concerned using the noscale option.
☞ For more details, see the next section ‘Switching off options’.
30 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
stat=stat_name Defines the statistics to be calculated on the table.
☞ For further information, see chapter 4, ‘Descriptive statistics’ and chapter 5, ‘Z, T and F tests’ in the Quantum User’s Guide Volume 3. tstat
Calculate special T statistics and include elements in them as requested by tstat statements after tab statements and by tstat options on elements.
☞ For further information, see chapter 7, ‘Special T statistics’ in the Quantum User’s Guide Volume 3. useeffbase
Causes the n19 standard error to be calculated using the weighted count of respondents rather than the unweighted count.
☞ For further information, see section 5.4, ‘The mean, standard deviation, standard error and error variance’ and ‘Weighted runs’ in chapter 5, ‘Statistical functions and totals’. wm=n
This keyword names the weighting matrix to be used.
wmerrors
This keyword is valid on the a and wm statements only. This keyword is in force by default. It causes Quantum to issue an error message and to stop running when certain weighting errors are detected. By using the nowmerrors keyword, you can make Quantum issue a warning and to continue running instead. Regardless of the setting of this keyword, Quantum provides details of the error in the weighting report file, weightrp.
☞ For further information, see chapter 1, ‘Weighting’ in the Quantum User’s Guide Volume 3.
The hierarchy of the tabulation section – Chapter 2 / 31
Quantum User’s Guide Volume 2
Switching off options Many of these keywords act as switches, turning a particular feature on or off. For instance, we noted above that the options page and type define defaults for printing the page number and output type at the top of each page automatically, and are therefore more commonly used in their negative form to switch off these facilities when they are not required. Some options can be switched off by preceding the keyword with the word no. Thus, printing of page number and output type are switched off by the options nopage and notype. Options in which the keyword is followed by an equals sign lose the equals sign when no is added; thus, scale= becomes noscale. Options which may be preceded by no are: acr100
netsm
smrow
axcount
netsort
smtot
axtt
nsw
sort
date
nzcol
title
dp
nzrow
topc
dsp
page
tstat
flush
pc
tstatdebug
graph
physpag
type
inc=
round
useeffbase
manipz
scale=
wmerrors
missingincs
smcol
In all cases except page, pc, type, and wmerrors the negative version of these keywords is the default and would not normally appear on the a statement. You would probably use it on a sectbeg, flt or tab statement to turn off the default for a particular table or group of tables. This will be discussed more fully in the appropriate sections. You may switch off global suppression of small absolutes, column or total percentages by setting the suppression value to zero (for example, smsupp=0). Again, you would normally do this on a flt or tab statement to cancel a run-level option for a specific table or group of tables only.
2.4 The default options file Often you will find that you need the same default options for a series of jobs. You can either write an a statement for each job or you can set up a file which defines default options for one or more jobs. This file, known as the default options file, should contain only an a statement listing any of the options described above. Depending on the file’s location, these defaults will refer either to all jobs run at an installation or just to one particular job. 32 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
☞ For more information, see section 1.3, ‘The default options file’ in the Quantum User’s Guide Volume 4.
2.5 Sample tables This section contains sample tables to illustrate more clearly the function of some of the options described in this chapter. It is not important at this moment to understand how the tables were created.
Total percentages Our first example illustrates total percentages. These are calculated by percentaging each cell against the total number of people in the most recent base. In this example there is only one base so percentages are calculated using the total number of people in the table. From this we can see that 21% of our sample were women between 21 and 34 years of age. Note that we have also overridden the default of 1 decimal place for percentages and that percentages are printed directly beneath absolutes. This table was produced by the statement: tab age sex;op=1&;decp=0;flush
Page 1 Absolute/total percents Q2. Age Base: All Respondents Total Base
605
11 - 20 Yrs
120 20% 290 48% 146 24% 49 8%
21 - 34 Yrs 35 - 54 Yrs 55+ Yrs
Male 341 56% 73 12% 161 27% 81 13% 26 4%
Female 264 44% 47 8% 129 21% 65 11% 23 4%
Figure 2.1 Total percentages
The hierarchy of the tabulation section – Chapter 2 / 33
Quantum User’s Guide Volume 2
Cumulative column percentages The next table is exactly the same except that it uses op=127 to give absolutes and cumulative column percentages:
Page 2 Absolute/col percents Q2. Age Base: All Respondents Total Base 11 - 20 Yrs 21 - 34 Yrs 35 - 54 Yrs 55+ Yrs
605 120 20% 290 48% 146 92% 49 100%
Figure 2.2 Cumulative column percentages
34 / The hierarchy of the tabulation section – Chapter 2
Male 341 73 21% 161 69% 81 92% 26 100%
Female 264 47 8% 129 67% 65 91% 23 100%
Quantum User’s Guide Volume 2
Indices Our third table with op= shows indices created with op=128. This time we have specified two decimal places for percentages. Notice, though, that the indices are only ever shown as whole percentages. Each index is created by taking the column percentage for the cell and dividing it by the percentage in the most recent base column. For instance, the index of 108% for women aged 55 or more is created by dividing 8.71% (column percent) by 8.10% (base column percent).
Page 3 Absolute/col percents/indices Q2. Age Base: All Respondents Total Base
Male
605
Female
341 100%
264 100%
11 - 20 Yrs
120 19.83% 100%
73 21.41% 108%
47 17.80% 90%
21 - 34 Yrs
290 47.93% 100%
161 47.21% 98%
129 48.86% 102%
35 - 54 Yrs
146 24.13% 100%
81 23.75% 98%
65 24.62% 102%
49 8.10% 100%
26 7.62% 94%
23 8.71% 108%
55+ Yrs
Figure 2.3 Indices created with op=8
The hierarchy of the tabulation section – Chapter 2 / 35
Quantum User’s Guide Volume 2
Table of means The next table is a table of means created by the statement: tab q7 ban1;means;dec=2
The row axis for this table was as follows. The meaning of each statement is explained in the chapters on axes. l q7 n01Age of Car;c=c121’1/4’;inc=c121 n01Price;c=c122’1/4’;inc=c122 n01Availability of Spare Parts;c=c123’1/4’;inc=c123 n01Reputation of Manufacturer;c=c124’1/4’’;inc=c124 n01Mileage;c=c125’1/4’;inc=c125 n01Sound Bodywork;c=c126’1/4’;inc=c126 n01Reputation of Dealer;c=c127’1/4’;inc=c127 n01Extras (e.g. Radio);c=c128’1/4’;inc=c128
If a ‘1’ in a column means that the item is not important, and a ‘4’ in that column means that it is very important, the total mean value for the first row (3.10) tells us that people think the age of the car is quite important when buying a secondhand car. Because of the rounding involved in calculating means, it is important that you specify the number of decimal places that will provide the level of accuracy that you require. In this example, the keyword dec= on the tab statement has been used to specify two decimal places.
✎ Statistical tests on means specified by the means option are likely to give inaccurate results. If you want to request a statistical test on mean values, specify the mean by using an n12 statement.
☞ For further information, see section 5.4, ‘The mean, standard deviation, standard error and error variance’.
36 / The hierarchy of the tabulation section – Chapter 2
Quantum User’s Guide Volume 2
Q7: Importance of Each of the Following When Buying a Secondhand Car Sex Total Male Female
Age Over 30 Under 30
MEAN IMPORTANCE Age of Car
3.10
3.17
3.00
2.60
3.60
Price
1.90
1.83
2.00
1.40
2.40
Availability of Spare Parts
2.80
2.83
2.75
2.40
3.20
Reputation of Manufacturer
1.90
2.17
1.50
1.60
2.20
Mileage
3.10
3.33
2.75
3.00
3.20
Sound Body
2.20
1.83
2.75
2.40
2.00
Reputation of Dealer
3.30
3.17
3.50
3.20
3.40
Extras (e.g. Radio)
1.70
2.00
1.25
2.00
1.40
Figure 2.4 Table of means Tables of the maximum or minimum values of inc variables can be generated in the same way simply by replacing the keyword means on the tab statement with maxim or minim as appropriate. The keywords minim and maxim are also valid on individual statements in an axis. When used in this way they create an element that shows the minimum or maximum values of the inc= variable specified for that element. Here is an axis that creates three elements. The first is the minimum price paid, the second is the maximum price paid, and the third is the mean price paid (the n25 does not create a printed element): l price n01Minimum price paid;inc=paid;minim n01Maximum price paid;inc=paid;maxim n25;inc=paid n12Mean price paid
✎ The minim and maxim calculations ignore means that are zero.
The hierarchy of the tabulation section – Chapter 2 / 37
3 Introduction to axes The axis is an integral part of your tabulation program: without it there can be no tables. At its simplest level an axis represents a question on the questionnaire, and contains statements which define the responses to that question and the codes by which Quantum can identify them. Each axis may be used to create one or more of the following: •
The rows of a table.
•
The columns of a table.
•
A page in a set of tables.
•
A set of pages in a group of tables.
For instance, if we have an axis called region, we can use it to create tables in which each row is a different region, or in which each column is a different region. We can also use it in such a way that each region creates one or more pages in a group of tables. Items in an axis are called elements and each element may generate one or more lines or pages in a table. For example, when an axis is used to create the rows of a table, one element may show the same set of figures presented in three different forms, say, absolutes, column percentages and row percentages, to name the most common. In this chapter we introduce some of the statements used in axes and tell you how to define precisely which respondents should be included in which element.
3.1 Naming the axis Quick Reference To name an axis and define any options applicable to the axis as a whole, type: l name [;options]
Each axis must have a unique name. To avoid any misinterpretation, you should avoid giving an axis the same name as any other variable in the run. In Quantum versions 5e.5 and later, there is no limit to the number of characters you can use for an axis name, but the name must not contain spaces and must start with a letter. You can use only the following characters in a name: A through Z _ 1234567890.
Introduction to axes – Chapter 3 / 39
Quantum User’s Guide Volume 2
Also, remember that Quantum is case-insensitive and therefore does not distinguish between uppercase and lowercase letters. For example, regions is the same as REGIONS. Axes are named using an l statement: l axis_name For example: l product
There are also certain keywords which may appear on l statements: anlev=level
Defines the level at which the axis should be created. Only used when data is processed with analysis levels.
☞ For further information about analysis levels, see chapter 3, ‘Dealing with hierarchical data’ in the Quantum User’s Guide Volume 3. axreq=ctype
Defines the coding requirements for the axis. The type of coding may be: none
no requirements (default). May be used on the l statement to override a different option on the a statement.
sc
single-coded
scb
single-coded or blank
nb
not blank
☞ For further information, and an example of the output, see ‘Data options’ in chapter 2, ‘The hierarchy of the tabulation section’. byrows
Exports grid axes on a row-by-row basis when exporting data from Quanvert to SAS and SPSS.
☞ For further information, see section 10.6, ‘Exporting grid axes in Quanvert’. c=logical_expression Defines the condition which must be met in order for a respondent to be included in the axis.
☞ For further information on c=, see section 3.3, ‘Defining conditions for an element’.
40 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
clear=logical_expression Determines when flags should be reset in the intermediate table when trailer cards are read.
☞ For further information, see section 3.2, ‘clear= on the l statement’ in the Quantum User’s Guide Volume 3. colwid=n
Specifies the output column width when the axis is used as a breakdown (banner).
☞ For further information about column widths and colwid=, see section 6.5, ‘Manual set-up’. dsp
Causes the elements to be double spaced when the axis is used as the rows of a table; that is, a blank line is printed between each row of the table (see Figure 3.1).
exportmp
Forces an axis to be multicoded when exporting from Quantum to SPSS using the nqtspss program.
☞ For further information, see section 4.3, ‘Converting Quantum data and programs with nqtspss’ in the Quantum User’s Guide Volume 4. figbracket
Prints the character defined with figchar in front of each absolute, and prints the corresponding closing bracket after each absolute.
☞ For further information on the fig group of options, see section 3.8, ‘Printing characters next to absolutes’. figchar=
Defines a character to be printed before and/or after absolutes.
figpre
Prints the character declared with figchar= in front of each absolute value.
figpost
Prints the character declared with figchar= after each absolute value.
hd=text
Defines an overall axis heading which is printed above the base row when the axis is a row axis, or above the columns when the axis is used as a breakdown. If the table spans more than one page, the axis heading will be printed above the first element on each subsequent page. When the axis is used as a higher dimension, the axis heading is printed at the top left of the page. You can determine its position relative to the other tables titles using the keyword high within the a/sectbeg/flt/tab option ttord=.
☞ For information on ttord=, see ‘Output options’ in chapter 2, ‘The hierarchy of the tabulation section’.
Introduction to axes – Chapter 3 / 41
Quantum User’s Guide Volume 2
inc=arith_expression Causes cell counts in a table using this axis to be incremented by the value of the arithmetic expression, rather than by 1 for each respondent present in the axis. If inc= is also present on the a/sectbeg/flt or tab statement, then the increment on the l statement is applied as well as that at the higher level. For example: tab region house;inc=c132 l region;inc=c(115,116)
produces a table of region by type of house in which each cell is incremented first by the value in c132 and then by the value in c(115,116). If c132 contains the value 6 and c(115,116) contains the value 10, then the cell counts will be incremented by 60 for that respondent.
☞ For a more detailed description, see ‘Data options’ in chapter 4, ‘More about axes’. inctext=description_text Can be used with the inc= option to specify a description text for a numeric variable. When a numeric variable appears many times in the program, Quantum only uses the first inctext= associated with the variable. However Quantum issues a warning on the screen and in out1 if the text on subsequent inctext= statements differs from that on the first statement. This test is case-sensitive, so Quantum issues a warning if the first text is ‘Serial number’ and the second is ‘serial number’. If no inctext= is specified for an inc=, Quantum generates a description text that matches the specified name. If inctext= is specified on a statement with no inc=, it is ignored with a warning message. inctext= is not valid for elements of grid axes, nor for pre= or post= options on wm statements.
✎ You define numeric variables for use in Quanvert databases and for export to SPSS or SAS with the namedinc statement.
☞ For information about using namedinc for exports to
or SAS, see chapter 4, ‘Data conversion programs’ in the Quantum User’s Guide Volume 4. For information about using namedinc when setting up a Quanvert Database, see chapter 5, ‘Preparing a study for Quanvert’ in the Quantum User’s Guide Volume 4. SPSS
missing=logical expression Treats any record that satisfies the logical expression as a record with a missing value. This option is usually used with inc=.
42 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
☞ For further information, see the notes on inc= in ‘Data options’ in chapter 4, ‘More about axes’. netsm
Indicates that suppressed elements should be collected into an element flagged with smsup+ only if that element is at the same level as the suppressed elements. For example, if an element at net level 2 is suppressed because its cell counts are below a given value, that element will only be included in the table if there is an element with smsup+ at level 2 into which it can be added. Without netsm, suppressed elements will be added into the next smsup+ element regardless of whether it is at the correct level. Thus, an smsup+ element at level 2 may contain elements at level 2 and also any previously suppressed elements from level 1.
☞ For an example and a more detailed explanation, see ‘Accumulation of suppressed elements by net level’ later in this chapter. netsort
This statement is valid on a and l statements only. Requests that nets defined with the net statement should be sorted according to their net level. This means that nets at level 1 will be sorted and, within them, nets at level 2, and so on. Elements within a net are also sorted. When netsort is used, each level below level 1 will be indented by 2 spaces per level — thus nets at level 2 are indented by 2 spaces (1×2 spaces); nets at level 3 are indented by 4 spaces (2×2 spaces). The elements comprising a net are indented by an additional two spaces. The number of spaces indentation can be varied using netsort=n, where n is a whole number in the range 1 to 9, and is the number of spaces by which to indent. For example, netsort=3 will indent by multiples of 3 spaces. If a global indentation is set for all sorted tables of nets in the run, it may be turned off for an individual table by entering nonetsort or netsort=0 on the l statement for the table’s row axis.
✎ For netsort to work, the keyword sort must be present on the same statement as netsort or on a statement at a higher level. For example, to sort the nets in a single table, place netsort on the l statement of the row axis and sort on the a, sectbeg, flt or tab statement.
☞ For examples of nets and sorted nets, see section 3.6, ‘Netting’ in this volume and section 6.3, ‘Sorting tables’ in the Quantum User’s Guide Volume 3. For more information about subsorts, see ‘Sorting with subsort and endsort’ in chapter 6, ‘Other tabulation facilities’ in the Quantum User’s Guide Volume 3.
Introduction to axes – Chapter 3 / 43
Quantum User’s Guide Volume 2
notstat
Sets the default for the axis to be that elements are excluded from special T statistics.
☞ For further information, see section 7.1, ‘Which elements are tested?’ in the Quantum User’s Guide Volume 3. numcode
Flags an axis as being single coded. When Quantum encounters an axis flagged in this way, it only allows space for single coding in the datapass. This reduces the amount of temporary disk space required for processing large axes during the datapass and accumulation stages of the run (when the data is read and the table cell counts are calculated), as well as when flipping databases for use with Quanvert. When you flag an axis with numcode, Quantum assumes that it is single coded and does not check it. If a record in the axis is then found to be multicoded, only the first code is taken. The first code is determined by the order in which codes are defined in the axis. For example, if the axis is: col 123;Red;Blue;Green;Yellow;Orange;Black;Brown
and the record is multicoded with ‘247’, only code 2 will be accepted so the record will be treated as if the respondent chose blue only.
✎ Quantum considers an axis to be multicoded if the data on which it is based is multicoded, or if it contains any net, ndi, nsw or n25 elements, or if it contains any n00 or n10 elements with conditions. nz
Causes elements in which all cells are zero to be omitted from the printed tables. When columns are suppressed in an axis whose column headings are defined on g statements, Quantum ignores the g statements and creates its own column headings using the texts defined on the elements themselves. When suppressing rows and/or columns that are zero, you should follow a few basic rules as to where in the run you should place the nz keyword.
☞ For further information about where to place the nz keyword, see section 4.8, ‘Options on n, col, val, fld and bit statements’. For further information about column headings, see chapter 6, ‘Using axes as columns’. sort
Indicates that the elements of the axis should be sorted.
☞ For further information on sorting, see section 6.3, ‘Sorting tables’ in the Quantum User’s Guide Volume 3.
44 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
summary
For ex= elements on n01 statements, summary indicates that the raw counts and not the calculation results are to be used to decide whether rows or columns are to be suppressed in a secure Quanvert database.
☞ For further information, see section 7.11, ‘Secure databases’ in the Quantum User’s Guide Volume 4. tstat
Include all elements of this axis in the special T statistics. This is used to set a default for the axis when only a few elements need excluding from the statistics. If you neither include nor exclude elements from the tests, Quantum will include all suitable elements.
☞ For further information about special T statistics, see chapter 7, ‘Special T statistics’ in the Quantum User’s Guide Volume 3. uplev=level
Defines the level at which the axis should be updated. Only used with analysis levels.
☞ For further information about analysis levels, see chapter 3, ‘Dealing with hierarchical data’ in the Quantum User’s Guide Volume 3.
Certain of these options may also appear on the a, sectbeg, flt or tab statements. To switch off a global setting for an individual axis, you may precede the following options with no. Options ending with = lose the = sign when preceded by no: dsp
netsort
summary
inc
nz
tstat
netsm
sort
3.2 Types of elements within axes There are four types of element in an axis: •
Text and condition elements — these elements contain text and conditions which define the characteristics a respondent must have to be included in the element. In a simple axis each element will refer to one response to a question and will produce a row, column or table of figures telling you how many people gave that response.
•
Text elements — these elements create nothing but text; no cells containing counts or values are created from these elements.
Introduction to axes – Chapter 3 / 45
Quantum User’s Guide Volume 2
•
Arithmetic elements — these are elements which contain arithmetic values rather than counts. For example, one element may tell you the number of times a product was bought rather than the number of people who bought it.
•
Statistical elements — these elements contain totals, subtotals or statistical functions such as means and standard deviations.
3.3 Defining conditions for an element Quick Reference The general format of a condition is: c=logical_expression
Conditions define the characteristics a respondent must have in order to be included in a particular element. (At a higher level, they define which respondents are eligible for inclusion in a table or a group of tables.) Each element refers to one or more responses from the questionnaire, and you will need to identify both the columns in which the responses were coded and the codes assigned to those answers. Let’s take the question asking which color the respondent likes best. There are four choices, Red, Blue, Green and Yellow, coded 1, 2, 3 and 4 respectively in column 25 of card 1. This will generate four elements, one for each color. What we need to do is find some way of telling Quantum that anyone with a 1 in column 25 of card 1 belongs in the first element, while anyone with a 4 should go in the fourth element. In chapter 5, ‘Expressions’ in the Quantum User’s Guide Volume 1, we talked about various types of expression, one of which was the logical expression which returns a value of true or false. We said that statements of the form cn’p’ were logical expressions since the expression is true if column n contains the code ‘p’ or false if it does not. This is just what we want because it means that we can write c125’1’ to gather together all respondents having a ‘1’ code in column 25 of card 1 (remember that with multicard records the last two digits are the column number and any previous digits are the card type). If the respondent has a ‘1’ in this column, the expression is true. The respondent satisfies the condition for the element and is included in the counts for it. If there is no ‘1’ in c125 the expression is false and the respondent is rejected from the counts. Having found a way of defining the condition, we now need to present it in a way that Quantum can understand. Quantum knows what c125’1’ means, but if you just write that by itself Quantum will not know what to do with it. To show that this defines a condition for an element we write c= (short for condition=) and then the expression, thus: c=c125’1’
46 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
The general format of conditions is: c=logical_expression
☞ For information about the various forms a logical expression can take, see section 5.2, ‘Logical expressions’ in the Quantum User’s Guide Volume 1.
A condition can be any valid logical expression. The conditions are written exactly as they are in the edit. For example, a condition such as: c=c234’12’
is read as an ‘or’ condition meaning that any respondent for whom column 234 contains code ‘1’ or code ‘2’ or both is eligible for inclusion in the element created by this condition. Any other codes in this column are ignored. To specify that a respondent may be included if he has a specific code or set of codes only, use the form c=c234=’1’. This means that the respondent is added into the counts if c234 contains a ‘1’ and nothing else. Notice here that the statement contains two equals signs, one for the c= and one as part of the logical expression. The logical expression c=c234n’12’ is used when the condition requires that the respondent does not have a ‘1’ or a ‘2’ or both in column 234. The expression need not be restricted to single columns. It is quite correct to write: c=c(121,123)=$101$
if you mean to gather respondents who have a ‘1’ in c121, a ‘0’ in c122 and a ‘1’ in c123. You might do this when items have been coded with numbers rather than codes; a 101 in c(121,123) could represent a 1971 Ford Escort car. Other sorts of logical expression are valid as well. For example, the condition: c=miles.gt.100
indicates that respondents are eligible for inclusion if the value of miles is greater than 100. The condition: c=numb(c163,c171,c175).eq.1
only counts respondents having one code overall in columns 163, 171 and 175. This means that for a respondent to be eligible, one of those columns must be single-coded and the other two must be blank.
Introduction to axes – Chapter 3 / 47
Quantum User’s Guide Volume 2
Special conditions Quick Reference Special conditions unique to the tabulation section are: c=−
Counts respondents eligible for inclusion in the axis who have not appeared in any elements since the last base element.
c=−n
Counts respondents eligible for inclusion in the axis who have not appeared in the last n elements.
c=+
Counts respondents in any of the elements since the last base element.
c=+n
Counts respondents in the last n elements.
There are some special condition statements that can be used to accumulate counts of respondents on the basis of whether or not they have been included in any, or a specified number of, elements since the last base in the axis. The following special condition statements are often used to deal with Don’t Knows and No Answers when there are no specific codes for these responses. They consider respondents to be eligible for inclusion in the axis if they meet the conditions on the l statement; they ignore any conditions on n10 and n11 statements: c=−
Counts all respondents eligible for inclusion in the axis who have not been included in any element since the last base element.
c=−n
Counts respondents eligible for inclusion in the axis who have not been included in the previous n elements.
The following special condition statements are often used to create ‘net’ elements in axes for questions with multiple choice or open end responses: c=+
Counts respondents included in any of the elements since the last base element.
c=+n
Counts respondents included in the previous n elements.
48 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
These special condition statements stop counting if they encounter one of the following elements in the axis: •
A base element.
•
An nsw element, which Quantum inserts after each base element in axes in weighted runs that request special T statistics.
•
An effbase element, which you can use to print an effective base element in a weighted table. If you want to print an effective base without affecting the processing of these special statements, use an n31 statement.
☞ For examples of these special condition statements and a description of ‘netting’, see section 3.6, ‘Netting’ in this volume. For further information on nsw elements, see chapter 7, ‘Special T statistics’ in the Quantum User’s Guide Volume 3. For details on the effective base, see section 5.8, ‘Printing the effective base’ in this volume and section 7.3, ‘T statistics on weighted tables’ in the Quantum User’s Guide Volume 3.
3.4 Count-creating elements Count-creating elements are the basis of any table since they can tell you how many respondents gave a response. There are several statements that create numeric elements; which you use depends on the type of data to be read and the complexity of the condition defining eligibility for inclusion in the element. Statements are: n01
Used for simple or complex conditions.
n15
Same as n01 except that the element is not printed.
n10
Creates a base for percentaging.
n11
Same as n10 except that the element is not printed.
col
Used for simple conditions.
val
Used for numeric data.
fld
Used for numeric codes.
bit
A variant of fld.
☞ For information on col, val, fld and bit statements, see chapter 4, ‘More about axes’.
Introduction to axes – Chapter 3 / 49
Quantum User’s Guide Volume 2
The n01 statement Quick Reference To define one count-creating element, type: n01[element_text] [;options] These elements are sometimes called basic or totalizable elements.
An n01 statement has three parts: n01[text] [;options] Each n01 in an axis will create one row/column/page in the table. In a row axis, this element may consist of several lines, depending on the types of figures requested. Conditions were explained in section 3.3, ‘Defining conditions for an element’ above, so let’s now look at a sample table to see how the elements were created.
Bread Purchase Survey Page 1 Absolutes/Col Percentages Base: All Respondents Sex
Base Marital Status Single
Base Male Female ------------------------------------200 44 156
44 22.0%
6 13.6%
38 24.4%
Married
122 61.0%
27 61.4%
95 60.9%
Divorced
33 16.5%
10 22.7%
23 14.7%
1 .5%
1 2.3%
1 0%
Widowed
Figure 3.1 Creating elements with n01 statements
50 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
Do not worry about how this whole table was created; for the time being we are only concerned with how to create the rows entitled Single, Married, Divorced and Widowed, and the columns named Male and Female. We will come on to how to create the other elements later in this chapter. First, let’s assume that marital status is coded as ‘1’ to ‘4’ in column 109 and that sex is a ‘1’ or a ‘2’ in c106. Next we need to name our axes. We’ll call them mstat and sex so that we know straight away which questions they refer to. To set up the mstat axis, we write: l mstat n01Single;c=c109’1’ n01Married;c=c109’2’ n01Divorced;c=c109’3’ n01Widowed;c=c109’4’
We can deal with the sex axis in exactly the same way: l sex n01Male;c=c106’1’ n01Female;c=c106’2’
The first n01 in the axis mstat defines the element text as ‘Single’ and the condition as c109’1’. As you can see, the element starts with the given text. Notice that it is printed exactly as it was written in the axis. If we had wanted it all in upper case or indented by two spaces, we would have had to write it in upper case or precede it by two spaces on the n01 statement. Normally a semicolon separates the element text from the element conditions. If you want a semicolon as part of the element text, type in a backslash (\) before the semicolon, thus: n01Hotels\;Guest Houses;c=c15’12’
✎ Quantum normally allows 24 characters per line for text. Shorter texts are padded with blanks, longer ones are split at the nearest blank, hyphen (–) or slash (/) and are continued on the next line. You may reset the amount of space allocated to side texts using the option side= on the a, sectbeg, flt or tab statement or you can split long texts manually using one of the statements.
☞ For information about setting side text widths with side=, see ‘Output options’ in chapter 4, ‘More about axes’. For information about splitting long row texts manually, see section 3.5, ‘Subheadings and extra text’. For information about setting break points in element texts in column axes, see section 6.3, ‘Defining breakpoints in element texts’.
Introduction to axes – Chapter 3 / 51
Quantum User’s Guide Volume 2
The condition for single people states that only respondents having a ‘1’ in c109 will be included in the counts. Exactly which people are included in each cell of the row depends upon the column conditions. Cells in a table are created by the intersection of a row with a column. This creates an ‘and’ condition since the respondent must satisfy both the row and the column conditions to be included in that cell. Take, for example, the elements Single and Male. The cell created by their intersection has the condition: c109’1’ .and. c106’1’
There are six respondents satisfying this condition, so we have six men who are single.
Simplifying complex conditions So far, we have dealt with simple conditions — those with one column and one code only — but you may write conditions of any complexity. Here is an example. Suppose our questionnaire contains two awareness questions, one for awareness of the product and the other for awareness of advertising about it. Awareness of the product is tested using aided and unaided responses, with the first unaided response being coded separately from other unaided responses. Awareness of advertising is also aided and unaided, but there is no distinction between first and subsequent mentions. Here is part of the questionnaire:
Sparkle Gleam Suds Washo
Product Awareness ----------------First Other Aided (110) (111) (112) 1 1 1 2 2 2 3 3 3 4 4 4
Advert Awareness ---------------Unaided Aided (113) (114) 1 1 2 2 3 3 4 4
We want to set up statements to create elements showing whether or not respondents were aware of a brand’s existence and whether or not they remembered seeing or hearing any advertising for it, regardless of whether responses were aided or unaided. Statements are as follows: n01Aware of Sparkle;c=c110’1’.or.c111’1’.or.c112’1’ n01Aware of Gleam;c=c110’2’.or.c111’2’.or.c112’2’ . n01Aware of Washo Advertising;c=c113’4’.or.c114’4’
As you can see, the conditions for each element are quite long and require careful typing to collect the appropriate respondents.
52 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
A more efficient way of writing such conditions is to merge the codes in columns 110, 111 and 112 into a spare column in the edit as follows: ed clear c181 /* c181 = aware of product at all c181 = or(c110,c111,c112) . end . l q3 n01Aware of Sparkle;c=c181’1’ n01Aware of Gleam;c=c181’2’ .
Here we are saving in c181 any codes which are present in at least one of the columns c(110,112): that is, any brand that the respondent is aware of, either spontaneously or after prompting. We then use this variable to determine which respondents are collected into each element. In our example we have used the or operator, but this method works equally well for and and xor.
☞ For further information about these operators, see ‘Assignment with and, or and xor’ in chapter 8, ‘Changing the contents of a variable’ in the Quantum User’s Guide Volume 1.
Producing tables for product tests can often be simplified by copying data to different cards according to the order in which the products were tried. If we take the previous example, in which half the respondents tried A then B while the rest tried B then A, the only way of finding which product the respondent was talking about was to look at the code in column x telling us which product was tested first. This can lead to unnecessarily complex and lengthy specifications. One of the simplest solutions to this is to copy data for each group of respondents to a different card, and to reorganize the order of the data for one set of respondents so that answers about product A always precede answers about product B, regardless of the order in which they were tried. Once this recoding is done, the tabulation of the data becomes straightforward.
Introduction to axes – Chapter 3 / 53
Quantum User’s Guide Volume 2
Again, here is part of the questionnaire: Order in which products tried c118 ---A then B 1 B then A 2
Q6 Which product did you prefer for... Prefer | Prefer | | No Real 1st Prod.|2nd Prod.|No Pref.| Difference ----------------------------------------Washing Woolens 1 | 2 | 3 | 4 Washing Silk 1 | 2 | 3 | 4
(127) (128)
The questionnaire simply refers to the first and second product tried, but the client wants to know whether respondents preferred Brand A or Brand B for each task. He or she also wants to know whether the item preferred depends upon whether or not it was tried first. Here is an example of how to write an edit to shift the data and a table specification using the new card. ed /*A then B : copy in existing order if (c118’1’) c(401,480)=c(101,180);goto 1 /*B then A : reorganize data as it is copied c(401,426)=c(101,126) /*For washing woolens if (c127’1’) c427’2’ if (c127’2’) c427’1’ if (c127n’12’) c427=c127 /*For washing silk if (c128’1’) c428’2’ if (c128’2’) c428’1’ if (c128n’12’) c428=c128 c(429,480)=c(129,180) 1 continue /* rest of edit follows using c(401,480) etc. end
54 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
a;dsp;decp=0;spechar=-*;flush tab tests order ttlPreference for Selected Characteristics l tests n10Base n23Washing Woolens n01Noticed a Difference;c=c427’1/3’ n01 Prefer Product A;c=c427’1’ n01 Prefer Product B;c=c427’2’ n01 No Preference;c=c427’3’ n01Did Not Notice a Difference;c=c427’4’ l order n10Total n01Tried A First;c=c418’1’ n01Tried B First;c=c418’2’
The following figure shows what the table might look like.
Preference for Selected Characteristics
Total
Tried A First
Base
330
Washing Woolens Noticed a Difference
200 61%
97 30%
103 57%
Prefer Product A
90 27%
44 30%
46 26%
Prefer Product B
82 25%
36 24%
46 26%
No Preference
28 9%
17 11%
11 6%
130 39%
53 35%
77 43%
Did Not Notice a Difference
150
Tried B First 180
Figure 3.2 Table for product tests
Introduction to axes – Chapter 3 / 55
Quantum User’s Guide Volume 2
If we had not copied the data to other cards, the definition of someone preferring product A for washing woolens would have been: n01Prefer Product A;c=(c127’1’.and.c118’1’).or.(c127’2’.and.c118’2’)
The n15 statement Quick Reference To define a non-printing count-creating element, type: n15[text] [;options]
This statement acts exactly like an n01 except that the numbers it generates are not printed in the table. However, these figures are used in various statistical calculations and totals.
☞ For further information about totalling and statistical statements, see chapter 5, ‘Statistical functions and totals’.
Creating a base Quick Reference To create a printing base element, type: n10[text] [;options] To create a nonprinting base element, type: n11[text] [;options]
In most tables, including the sample table in Figure 3.1, the first row and column contain totals. These are the total number of respondents eligible for inclusion in that row or column. The intersection of the base row and the base column is the table base — that is, the total number of respondents eligible for inclusion in the table as a whole. Notice that we say ‘eligible for inclusion in the table’ rather than actually in the table. Bases are not totals and should not be confused with them. If everybody who is eligible for inclusion in the table is, in fact, included, the base and the total may well be the same, but this is not always the case. In a table of marital status by sex, the base is generally the total respondents in the table since everyone has an age and marital status. But, if we omitted the element for Males, our base would still be the total number of respondents, even though the table would only contain women. 56 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
The purpose of a base element is to define a set of figures against which figures in subsequent elements can be percentaged. With this in mind, let’s look at the sample table in Figure 3.1 which has a base row and a base column. The base row has three cells, the last two showing us the total numbers of men (44) and women (156) eligible for inclusion in the table. These are created by the combination of the conditions ‘everyone’ (from the base row) and ‘male’ and ‘female’ from the column axis. The base column shows the total number of single, married, divorced and widowed respondents eligible for inclusion in the table. The table informs us that there are 10 divorced men. This represents 22.7% of all men in the table (10/44∗100=22.7). This is a column percentage. There are two statements which create a base: n10 and n11. They are formatted as follows: n10[text] [;options] n11[text] [;options] For example, if we add a base element to the axis sex, we get: l sex n10Base n01Male;c=c106’1’ n01Female;c=c106’2’
Use n10 if the base is to be printed in the table, or n11 if it is not. When a single table spans several pages, the last base row in the axis is printed on the continuation pages. However, you can stop it being printed by adding an n11 statement after the n10. Because the n11 is the last base in the axis, it will be repeated on the continuation page, but it will not be printed.
✎ Any table in which percentages are required must have an appropriate base otherwise no percentages will be calculated. By ‘an appropriate base’ we mean a base row for column percents (op=2) and a base column for row percents (op=0). Both bases are needed if you want total percentages (op=&).
3.5 Subheadings and extra text There are three statements which are used within an axis to create text-only elements. These are: n03
Create a text-only element.
n23
Create a subheading.
n33
Continue long element texts.
Introduction to axes – Chapter 3 / 57
Quantum User’s Guide Volume 2
All are formatted in the same way, with the text required starting immediately after the n statement number; for example, n23Heading Text. If the text is to be indented, precede it with spaces. A limited set of options are valid on n03 and n23 statements, most of which may also be used on other types of count-creating statements.
☞ For further information about the options that are common to many count-creating statements, see section 4.8, ‘Options on n, col, val, fld and bit statements’. Options unique to a particular text-creating element are discussed below in the relevant section.
Statements for extra text Quick Reference To create a text-only element, type: n03[element_text] [;options]
The n03 statement creates a new row of text whenever the axis is used as a row axis. It is ignored if the axis is used any other way, that is, as a column or higher dimensional axis. n03 statements are often used with no text to create extra spacing within tables. In the sample table in Figure 3.1, the blank line between the base row and the row for single respondents was created with an n03. The axis mstat now looks like this: l mstat n10Base n03 n01Single;c=c109’1’ n01Married;c=c109’2’
If you use an axis containing n03 statements to form the columns of a table, the n03s are ignored. So if this axis is used for the columns of a table, the first column is the Base and the second is for single people. Do not use an n03 to continue long texts from an n01 statement, use an n33 statement instead. An n03 creates a completely new row in the table, which means that if the row created by the n01 consists of several lines (for example, absolutes and percentages) the text on the n03 will be printed on the line after the last line of figures for the n01.
☞ For further information on n33 continuation statements, see ‘Text continuation statements’ later in this chapter.
58 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
A limited set of options is available with n03 elements: nz
[no]sort
subsort
unl
[no]row
[no]col
[no]high
☞ For further information on nz, see the following section. For further information on the other options, see section 4.8, ‘Options on n, col, val, fld and bit statements’.
Suppressing text-only rows Quick Reference To suppress text-only rows if all count-creating elements in the block are suppressed, type: n03[element_text];nz
Text-only rows created with n03 statements can be suppressed if all count-creating rows between them and the next text-only element, the next base or the end of the axis, whichever comes first, are also suppressed. This facility is not applicable in column axes where n03 columns are always ignored. To flag an n03 as eligible for suppression, use the option nz. For example: n03Preferred green;nz
When Quantum decides whether to print n03s flagged in this way it considers two things: •
It goes to the first text-only row and scans the following elements to see whether this n03 is one of a block. If so, it checks whether all n03s in the block are flagged with nz. If they are not, Quantum marks all the texts as printable and skips to the next n03.
•
If all elements in the text-only block are flagged with nz, Quantum then scans all count-creating elements between that block and the next text-only element, or the next base which follows at least one row of non-base figures, or the end of the axis, whichever comes first. If all those count-creating elements are suppressed, Quantum suppresses the text-only elements as well.
These two steps are repeated until the end of the axis.
Introduction to axes – Chapter 3 / 59
Quantum User’s Guide Volume 2
Here is a sample axis: n10base n03First group. Both rows and all;nz n03elements flagged for suppression;nz col 10;one;%nz;two;%nz;three;%nz n03Second group. Both rows and some;nz n03elements flagged for suppression;nz col 11;first;%nz;second;third;%nz n03Third group. One row and all;nz n03elements flagged for suppression col 12;one;%nz;two;%nz;three;%nz n03Fourth group. No rows and some n03elements flagged for suppression col 13;first;%nz;second;third;%nz
In the first group, the two text-only rows will be suppressed if rows one, two and three are suppressed. In the second group, the text-only elements will never be suppressed because the second element on the col statement is never suppressed. In the third group, the first text-only element will never be suppressed even if all rows in the group are suppressed because the second n03 has no nz. In the fourth group the text-only elements will never be suppressed because they are not flagged with nz.
Placing text in the body of the table Quick Reference To place text in the main body of the table, type: n03[element_text] [ coltxt[pos[±n] ]=cell_text where pos is l, r or c and is the justification of cell_text in each cell. Typing +n or −n defines additional movement by n spaces relative to the main justification.
60 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
You may also use an n03 to place text in the body of the table, above or below the cell values. A simple example would be to print a row of hyphens above a total or subtotal row to separate it more clearly from the rows which are included in it. The text to print is defined on an n03 statement with the option keyword coltxt=: n03[element_text] ;coltxt[pos[±n] ]=cell_text where: element_text
This is an optional element text.
pos
This defines the position of the cell text in the column, and is one of l (left justify), r (right justify) or c (center). The default is right justification.
±n
This defines an optional offset from the main justification. For example, l+2 means two character positions to the right of full left justification. If the offset would cause the text to be placed in an illegal position on the page, the characters affected are silently ignored. The default is +0.
cell_text
This is the text to be printed in each cell in the row. If this is too long to fit in column width, it is silently truncated.
Suppose our row axis counts self-employed people. The data has been coded to the nearest 1,000, so that a 1 in column 132 means that there were up to 999 self-employed people. The axis is as follows: l people n10Base n03Thousands of people n03;coltxtr+2=000’s n01Under 1000;c=c132’1’ n011000-2000;c=c132’2’ n012001-3000;c=c132’3’ n013001-4000;c=c132’4’ n014001-5000;c=c132’5’ n03;coltxt=---n04Total
If we tabulate this against an axis defining the region in which the survey was carried out, we can see, to the nearest thousand, the number of self-employed people in each region. Notice how we have used coltxt to print headings at the top of each column of figures (underneath the base) and again before the total row. The first coltxt element is offset to the right of the figures by two character positions, whereas the second one uses the default of right justification.
Introduction to axes – Chapter 3 / 61
Quantum User’s Guide Volume 2
Base Base 50 Thousands of People 000’s Under 1000 7 1000-2000 7 2001-3000 3 3001-4000 3 4001-5000 5 ---Total 25
Kent
Surrey
Sussex
Essex
10
14
10
16
000’s 1 1 1 1 1 ---5
000’s 2 3 1 1 1 ---8
000’s 2 0 0 1 1 ---4
000’s 2 3 1 0 2 ---8
Figure 3.3 Using coltxt to print text above/below cell counts
Subheadings in the axis Quick Reference To define a subheading element, type: n23heading_text[;hdlev=header_level_number] [;toptext=col_header] [;options] hdlev= allows you to define a hierarchy among subheadings if the axis contains subheadings at different levels. If heading_text is unsuitable for use when the axis forms the columns of a table, define a new heading with toptext=. Sometimes you may want to give the axis a heading as we have done in Figure 3.1. Here the axis headings are ‘Marital Status’ and ‘Sex’. These were written using n23 statements. As you can see, when the axis is used as a row axis, the heading is printed as a row of the table, at the point at which it appears in the axis definition. In our table it follows the base element because we wrote the n23 statement after the n10 base-creating element: l mstat n10Base n03 n23Marital Status n01Single;c=c109’1’ n01Married;c=c109’2’ n01Divorced;c=c109’3’ n01Widowed;c=c109’4’
62 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
When the axis is used to create columns, the heading is printed above the individual column headings and is separated from them by a blank line. If the axis is used at a higher level (for example, as a third dimensional axis) the axis heading becomes the title of each multidimensional table.
☞ For further information on multidimensional tables, see section 7.1, ‘Creating a table’. If you would like the subheadings to be underlined, place one of the options unl1, unl2 or unl3 on the n23: •
For row subheadings, unl1 underlines the complete text, unl2 underlines everything except blank strings, and unl3 underlines non-blanks only. The underlining is done by overprinting the heading text with underscore characters and looks like true underlining.
•
For column subheadings, there is currently no difference between the variations of unl: they all underline the whole text. Quantum replaces the blank line that it would normally print after the subheading line with a line of hyphens extending across all the columns to which the subheading refers.
•
When an axis is used as a higher dimension and the subheading becomes a table title, the request for underlining is ignored.
Other options valid with n23 are: [no]sort
subsort
[no]row
[no]col
[no]high
☞ For information on these options, see section 4.8, ‘Options on n, col, val, fld and bit statements’.
Nested subheadings for column axes If a column axis contains more than one n23, the text for each one is centered above the elements between it and the next n23 or the end of the axis. The hdlev= keyword allows you to define various levels of subheading, starting at level 1 for the top subheading down to level 9 for the lowest level. Quantum uses these level numbers to determine the order of precedence amongst the n23 texts in the axis and hence the text’s position in the column headings. For example: l ban01 n23Visitors to the Museum;hdlev=1 n10Base n23Sex;hdlev=2 col 110;Male;Female n23Age;hdlev=2 col 111;11-20=’12’;21-34=’34’;35-44=’56’;55+=’78’
Introduction to axes – Chapter 3 / 63
Quantum User’s Guide Volume 2
This example has one level 1 heading and two level 2 headings. The level 2 headings are at a lower level than the level 1 heading, so they are printed beneath that heading. At both levels, the headings are centered across the columns to which they refer so the level 2 subheading Sex is printed centrally above the columns for Male and Female, and the level 1 heading, Visitors to the Museum, is printed centrally above all columns. Here is an illustration of how these headings might be printed (the exact layout depends on the width of the side text and the page width):
Base
Visitors to the Museum Sex Age Male Female 11-20 21 -34 35-54
55+
This example starts at level 1 and uses sequential numbers for the lower level headings. This is not a requirement. As long as the lower level headings have a larger level number than the higher level headings, you may use any numbering system you like. Possible substitutes for this example would be 1 followed by 5, 2 followed by 3, or 3 followed by 7, to name but a few. Levels of the form 9 followed by 1 are invalid because the higher level has a larger number than the lower level. Headings which are too long to fit in a column or across a group of columns, can be defined on a block of n23 statements all at the same level so that they will be printed one below the other. The heading Visited Museum Before in the example below illustrates this point. l ban01 n23Visitors to the Museum;hdlev=1 n10Base n23Sex;hdlev=2 col 110;Male;Female n23Age;hdlev=2 col 111;11-20=’12’;21-34=’34’;35-44=’56’;55+=’78’ n23Visited;hdlev=2 n23Museum Before;hdlev=2 col 116;Yes;No
This might print as:
Base
Visitors to the Museum Sex Age Male Female 11-20 21 -34 35-54
Visited Museum Before 55+ Yes No
Entering blocks of n23s in this way does, of course, mean that you’ll also have two lines of subheading in the rows if you use the axis as a row axis. If this is not satisfactory, you may wish to consider using the toptext= option to define different headings for row and column texts for that element. For example, to replace the two-line heading Visited Museum Before with the single line Been Before, you would write: n23Visited Museum Before;hdlev=2;toptext=Been Before
64 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
and the headings would be printed as:
Base
Visitors to the Museum Sex Age Male Female 11-20 21 -34 35-54
55+
Been Before Yes No
Each heading or block of headings at the lowest level must be followed by some elements which produce counts; for example, basic elements such as n01 or col, or statistical or totalling elements such as n12 or n04. In our example above, each group of level 2 subheadings is followed by a col statement.
☞ For a full description of the col statement, see section 4.1, ‘The col statement’. Headings at higher levels need not be followed by count creating elements and are therefore useful for creating extra lines in the middle of the headings.
✎ You can also specify the layout of column headings manually using g statements. ☞ For more information, see section 6.5, ‘Manual set-up’.
Laying out subheadings Quick Reference To define the justification of a subheading above its columns when the axis forms the columns of a table, type: n23heading_text; hdpos=x where x is l for left justification, r for right justification or c for centered text (the default). Unless directed otherwise, Quantum centers n23 texts above the elements to which they refer. If you would prefer the text to be left justified above the columns to which it refers, add the option hdpos=l to the n23. If you would prefer the text to be right justified, use hdpos=r instead. (hdpos=c is also available for centered text but since this is the default you are unlikely to need it).
Introduction to axes – Chapter 3 / 65
Quantum User’s Guide Volume 2
The example below uses hdpos=l for the main heading and the subheadings Sex and Age, and hdpos=r for Visited Museum Before: l ban01 n23Visitors to the Museum;hdlev=1 n10Base n23Sex;hdlev=2;hdpos=l col 110;Male;Female n23Age;hdlev=2;hdpos=l col 111;11-20=’12’;21-34=’34’;35-44=’56’;55+=’78’ n23Visited;hdlev=2;hdpos=r n23Museum Before;hdlev=2;hdpos=r col 116;Yes;No Visitors to the Museum
Base
Sex Male
Age Female 11-20
21 -34
35-54
Visited Museum Before 55+ Yes No
Text continuation statements Quick Reference To continue a long element text on an n01 or n10 statement, type: n33continuation_text
The n33 is used to continue long texts from an n01 or an n10. We have already said that Quantum splits long texts automatically at a blank, hyphen or slash, but this may not always provide an acceptable solution. Using an n33 means that you can write your element texts exactly as you want them to appear in your table. As with n01s, text on an n33s which is longer than the element-text width (side=) will be split at a blank, slash or hyphen. If the n01 creates more than one line of figures, the n33 text will be printed adjacent to the second line of figures. Additionally, if the table is sorted (ranked) the n33 will remain with the statement whose text it continues rather than being ignored or sorted to the end of the table.
☞ For information on sorted tables, see section 6.3, ‘Sorting tables’ in the Quantum User’s Guide Volume 3.
An n33 placed immediately after an n03 (rather than an n01 or an n10) will be ignored.
66 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
3.6 Netting Quick Reference To create an element which nets respondents present in previous elements, type: netnet_level[element_text] [;options] To terminate a net, type: endnetnet_level or append the option: netendnet_level to the last element in the net.
Nets are generally used with multicoded responses to show how many people answered rather than how many answers were given. For example, if five people said the product was badly made and expensive, and these two comments were coded separately, the table would show two lines each containing five people. A net line including people who gave one response or the other or both would tell us that five people thought the product was badly made or expensive or both. Nets may follow or precede the lines to which they refer. Nets which come before the lines to be netted are created by the statement: netn[text] [;options] where n is the net level number and options are any options valid on elements, except c=. The first net in an axis must be net1. Any respondent fulfilling the conditions for at least one of the subsequent elements will be added into this net. There are three ways of ending a net. The first way is to add the option endnetn, to the last element in the net, where n is the net level number, thus: net1Efficacy Comments (Net) n01Cleans Well;c=c132’2’ n01Cleans Automatically;c=c132’9’ n01Don’t have to Scrub;c=c133’1’ . n01Removes Stains;c=c133’9’;endnet1
Introduction to axes – Chapter 3 / 67
Quantum User’s Guide Volume 2
The second is to follow the last element in the net with a netendn statement, where n is the level number of the net to be terminated: net1Fragrance Comments (Net) n01Pleasant Smelling;c=132’5’ n01Smells of Flowers;c=c132’7’ . n01Mildly Scented;c=c133’2’ netend1 n01No Comment;c=c(132,133)=$ $
The third method is to terminate the net by starting a new net with a net statement with the same or a higher level number. For example, a net3 statement terminates nets at levels 3, 4, 5, and so on; a net1 statement terminates nets at all levels: net1Efficacy Comments (Net) n01Cleans Well;c=c132’2’ n01Cleans Automatically;c=c132’9’ n01Don’t have to Scrub;c=c133’1’ . n01Removes Stains;c=c133’9’ net1Fragrance Comments (Net) n01Pleasant Smelling;c=132’5’ n01Smells of Flowers;c=c132’7’ . n01Mildly Scented;c=c133’2’ netend1 n01No Comment;c=c(132,133)=$ $
Here, the net entitled ‘Efficacy Comments’ counts respondents who satisfy any of the conditions up to the net entitled ‘Fragrance Comments’. Each respondent is counted once only, regardless of the number of comments he makes. The second net counts respondents who comment about the product’s fragrance. This time the net is terminated by a netend statement (an endnet1 option would have been equally acceptable) because the next element is not a net element. Nets may contain subnets nested up to nine levels deep (net2 to net9). As with top-level nets, each subnet may be terminated by: •
Appending endnet to the last element in the net.
•
A netend statement after the last element in the net.
•
Another net with a higher level number; for example, net1 terminates net2.
•
Another net at the same level; for example, net2 followed by another net2.
68 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
Any respondent who is part of a subnet is automatically included in the net for the parent level. Therefore, if net2 is a subnet of net1, everyone who is part of net2 is automatically part of net1 as well. If endnet or netend terminate two or more nets at different levels, the level number must be that of the highest level (that is, you use endnet1 or netend1 to terminate both net2 and net1). Let’s look at an example. l q27;hd=Orange Juice n10Base n03 net1Favorable Comments;unl1 net2Packaging n01Liked Bottle;c=c(123,124)=$12$ n01Liked Label;c=c(123,124)=$13$ n01Liked Color;c=c(123,124)=$15$ n03 net2Taste n01Tasted Sweet;c=c(123,124)=$22$ n01Tasted Fizzy;c=c(123,124)=$23$ n01Refreshing;c=c(123,124)=$25$ n03 net1Unfavorable Comments;unl1 net2Packaging n01Too Big;c=c123,124)=$51$ n01Not Strong;c=c(123,124)=$52$ n03 net2Texture n01Too Thick;c=c(123,124)=$57$ n01Too Many Bits;c=c(123,124)=$60$ netend1 n03 n01No Comments;c=-
Here, the net for favorable comments has two independent subnets. All respondents commenting favorably about the packaging are included in the first subnet, and everyone commenting favorably about the Taste are included by the second. Anyone who is present in one or both subnets is automatically included in the overall net for favorable comments. The same principle applies to the net for unfavorable comments and its subnets. Notice that the last element of the Texture subnet is followed by a netend1 statement because we are terminating a net1 and a net2.
Introduction to axes – Chapter 3 / 69
Quantum User’s Guide Volume 2
Sometimes you will want the net row printed underneath the elements which it includes. Nets of this type can either have the condition written in full: n01All Efficacy Comments;c=c132’29’ .or. c133’1/79’
or you can use the shorthand c=+n. Using the previous example we would write: n01Cleans Well;c=c132’2’ n01Cleans Automatically;c=c132’9’ N01Don’t have to Scrub;c=c133’1’ . n01All Efficacy Comments (Net);c=+10
We have used c=+10 because c132’29’ and c133’1/79’ refer to ten lines.
Automatic indentation of element texts Quick Reference To indent element texts for subnets automatically, type: netsort[=spaces_per_level] If you place the keyword netsort on the a or l statement, nets at each level below level 1 will be indented by 2 spaces per level. Thus, nets at level 2 are indented by 2 spaces (1×2 spaces); nets at level 3 are indented by 4 spaces (2×2 spaces), and so on. The elements comprising each net are indented by an additional two spaces.
✎ Unlike most options that are valid on the a statement, netsort is not valid on sectbeg, flt or tab statements. If we rewrite the example about orange juice using netsort, the first section of the table will appear as: Favorable Comments Packaging Liked Bottle Liked Label Liked Color
If you want to indent by something other than 2 spaces per level, use the option netsort=n, where n is the number of spaces by which to indent. To turn off netsorting for an individual table when netsort has been specified on the a statement, use either nonetsort or netsort=0 on the l statement for that table’s row axis.
70 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
Text-only net elements Quick Reference To define a text-only net element, type: nttnet_level[element_text]
Sometimes you will want to group a number of elements together under a net heading, but will not want to see any figures printed for that row. This usually happens when you have a group of miscellaneous comments which you want to list at the end of the table. There are two ways of dealing with this. The first is to write a standard n03 with the text required; the second is to use an ntt statement as follows: nttnet_level[element_text] For example: ntt1Miscellaneous Comments
This creates a text-only net heading at level n in which the text is indented by the number of spaces appropriate to that level. For instance, with netsort (or netsort=2) an nnt1 is not indented, an ntt2 text is indented by 2 spaces, and an ntt3 text is indented by 4 spaces. Although there are no figures associated with this element, any elements between this statement and a corresponding endnet option or netend statement will be included in any nets at lower levels. Thus, elements following an ntt2 statement will be included in the net created by the previous net1. If the table is sorted, the elements in the ntt group will be sorted although the group as a whole, including the ntt element will retain its original position in the axis.
☞ For an example of this, see ‘Sorting with subsort and endsort’ in chapter 6, ‘Other tabulation facilities’ in the Quantum User’s Guide Volume 3.
Introduction to axes – Chapter 3 / 71
Quantum User’s Guide Volume 2
Accumulation of suppressed elements by net level Quick Reference To control how small suppression elements are counted with smsup+ in tables of nets, use netsm and nonetsm on the a, sectbeg, flt, tab or l statement. To have net levels honored so that an smsup+ element contains only suppressed elements for that element’s level, use netsm. To ignore net levels and include suppressed elements in the next element with smsup+, use nonetsm.
When all cells in an element are less than a given value, Quantum can suppress that element and, optionally, add the suppressed values into the corresponding cells of another element. The options which define the value below which figures will be suppressed are smsupa, smsupp and smsupt. smcol and smrow determine whether small suppression is required for rows, columns, or both. The option which marks the row into which suppressed elements will be added is smsup+. If this option is not present, suppressed elements will not appear in the table at all.
☞ For information about all the sm options except smsup+, see ‘Output options’ in chapter 2, ‘The hierarchy of the tabulation section’. For information about smsup+, see ‘Output options’ in chapter 4, ‘More about axes’.
When an element definition includes smsup+, Quantum adds into it not only the records which satisfy the element’s condition, but also any previous elements which have been suppressed since the start of the table, the most recent base, or the most recent element with smsup+. The same principle applies to tables of nets. Let’s take the axis below as an example: l netaxis;c=numb(c232,233).gt.0 n10Base net1Color (Net) n01Green;c=c232’1’ n01Yellow;c=c232’2’ net2Red (Net) n01Scarlet;c=c232’3’ n01Vermillion;c=c232’4’ n01Crimson;c=c232’5’ n01Other reds;c=c232’6’;smsup+ net2Blue (Net)
72 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
n01Navy;c=c232’7’ n01Royal;c=c232’8’ n01Sky;c=c232’9’ n01Other blues;c=c232’0’;endnet2;smsup+ n01Other colors;c=c233’-&’;endnet1;smsup+ n01Other comments;c=c233n’ ’
Each net and subnet ends with an element for shades not mentioned specifically in the net. These elements include smsup+ so that any elements suppressed in that net will be added into the cell counts for these elements. However, if you create a table with this axis as it is here, you’ll find that Quantum takes no account of the net levels and simply adds suppressed elements into the next element with smsup+. Thus, if the Green or Yellow elements are suppressed, they will be added into the element for Other Reds which is not what is required. They will not be included in the Other Colors element which is where you’d expect them to go. When you use nets and smsup+ together, you should also use one of the options netsm or nonetsm to indicate how you want Quantum to deal with suppressed elements. These options may be used on a/sectbeg/tab/flt/l statements, but the option on the l statement overrides options on any of the other statements. With netsm, Quantum honors the different net levels and only includes suppressed elements in an smsup+ element at the appropriate level. In the example above, Other reds will include records which have c232’6’ and any suppressed red elements; Other blues will include records which have c232’0’ and any suppressed blue elements; Other colors will include records with c233’-&’ and also Green or Yellow if they are suppressed. With nonetsm, Quantum ignores the net levels when placing suppressed elements in smsup+ rows.
Percentaging with nets When you request percentages on a table of nets, Quantum calculates the percentages against the number of respondents in the base rather than on the number of responses in the net. If you want percentages based on net figures there are a number of things you can do. The first option is simply to place the keyword base on the net element. This flags the net element as a base and percentages for all elements that come after this net will be calculated using the net figure as a base. For example: l opinion n10Base n03 net1Favorable Comments;base fld c123 :2;Liked bottle=12;Liked label=13;Liked color=14; +Tasted sweet=22;Tasted fizzy=23;Refreshing=24 n03 net1Unfavorable Comments;base fld c123 :2;Too big=51;Not strong=52;Too thick=57;Too many bits=60
Introduction to axes – Chapter 3 / 73
Quantum User’s Guide Volume 2
Here the two level 1 nets are flagged as bases. This means that the percentage for favorable responses about the bottle will be calculated using the number of respondents making favorable comments of any sort as a base, rather than against the total number of respondents in the axis. The same is true for unfavorable comments where, for instance, the percentage for the comment ‘Too big’ is calculated against the number of people making unfavorable comments. Let’s look at the table itself:
Base Favorable Comments Liked bottle Liked Label Liked Color Tasted sweet Tasted fizzy Refreshing
Unfavorable Comments Too Big Not strong Too thick Too many bits
Base
Male
Female
126
59
67
74 19 25.7% 15 20.3% 24 32.4% 15 20.3% 10 13.5% 10 13.5%
45 13 28.9% 5 11.1% 16 35.6% 10 22.2% 7 15.6% 7 15.6%
29 6 20.7% 10 34.5% 8 27.6% 5 17.2% 3 10.3% 3 10.3%
51 20 39.2% 18 35.3% 10 19.6% 8 15.7%
26 11 42.3% 9 34.6% 4 15.4% 6 23.1%
25 9 36.0% 9 36.0% 6 24.0% 2 8.0%
Figure 3.4 Percentages against nets With this method you have percentages calculated against the net figures, but you have lost the percentages of the favorable and unfavorable comment nets against the table base. An alternative is to create the table using op=126 and to place base on the net elements. With this method the net elements have percentages calculated against the table base, while other elements have two percentages, one calculated against the table base and the other calculated against the appropriate net.
74 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
A third choice is to define nonprinting base rows immediately after the net elements: l opinion n10Base n03 net1Favorable Comments net2;base;norow fld c123 :2;Liked bottle=12;Liked label=13;Liked color=14; +Tasted sweet=22;Tasted fizzy=23;Refreshing=24 n03 n11;base net1Unfavorable Comments net2;base;norow fld c123 :2;Too big=51;Not strong=52;Too thick=57;Too many bits=60
This gives you one percentage for each row. The net rows are percentaged against the table base and the other elements are percentaged against the preceding net:
Introduction to axes – Chapter 3 / 75
Quantum User’s Guide Volume 2
Base Favorable Comments Liked bottle Liked Label Liked Color Tasted sweet Tasted fizzy Refreshing
Unfavorable Comments Too Big Not strong Too thick Too many bits
Base
Male
Female
126
59
67
74 58.7% 19 25.7% 15 20.3% 24 32.4% 15 20.3% 10 13.5% 10 13.5%
45 76.3% 13 28.9% 5 11.1% 16 35.6% 10 22.2% 7 15.6% 7 15.6%
29 43.3% 6 20.7% 10 34.5% 8 27.6% 5 17.2% 3 10.3% 3 10.3%
51 40.5% 20 39.2% 18 35.3% 10 19.6% 8 15.7%
26 44.1% 11 42.3% 9 34.6% 4 15.4% 6 23.1%
25 37.3% 9 36.0% 9 36.0% 6 24.0% 2 8.0%
Figure 3.5 Percentages against nets and the table base
3.7 Axes within axes Quantum provides facilities for defining an axis in which various of the elements are combined to form a subaxis (or pseudo-axis) which may be cross-tabulated as any standard axis. For example, the main axis may contain all the comments made about a new type of chocolate bar. However, you also need to produce some tables which include only comments about the flavor, color or price of the product. Instead of creating a separate axis for these comments, you can just flag the appropriate elements with a group name in the main axis. The subaxes may then be tabulated in the usual way by using the group name as the axis name on the tab statement.
76 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
✎ This facility is not available for grid axes. ☞ For information about the tab statement, see section 7.1, ‘Creating a table’.
Defining subaxes Quick Reference To mark the start of a subaxis, type: groupbeg group_name [, group_name2, ... ] To mark the end of a subaxis, type: groupend group_name [, group_name2, ...] If the elements forming a subaxis are scattered throughout the axis, flag each one with the option: group=group_name [, group_name2, ...]
There are two ways of allocating elements to a subaxis, depending on whether or not the elements come one after the other in the main axis. If the elements forming a subaxis do come one after the other, they can be grouped by placing the statement: groupbeg groupname on the line immediately above the first element, and: groupend groupname on the line immediately after the last element in the group.
Introduction to axes – Chapter 3 / 77
Quantum User’s Guide Volume 2
For example: l allchoc n10Base n01Trouble undoing wrapping;c=c142’8’ n01Didn’t like plastic wrapping;c=c141’1’ groupbeg taste n01Too sweet;c=c141’4’ n01Chocolate coating was too sweet;c=c141’7’ n01Chocolate coating was awful;c=c141’0’ n01Not sweet enough;c=c141’5’ n01No taste at all;c=c141’3’ groupend taste n01DK/NA;c=c(141,142)=$ $
Here is a subaxis containing comments about the taste of a chocolate bar. It can be used as an axis in its own right by naming it on a tab statement, or its elements can be treated as part of the main axis when that axis is used in a table. In the latter case, the groupbeg/end statements will be ignored. If an element forms the start (or end) of more than one group, the group names may be listed on the same statement, separated by commas, thus: groupbeg taste,coating n01Chocolate coating was too sweet;c=c141’7’ n01Chocolate coating was awful;c=c141’0’
Quantum allows you to enter the same group name for several blocks of elements in the main axis. This provides for occasions when a subaxis comprises more than one set of consecutive elements. An example might be when you want to create a subaxis of comments about the chocolate bar itself, but to exclude comments about the wrapping or the price: l allchoc n10Base n01Trouble undoing wrapping;c=c142’8’ n01Didn’t like plastic wrapping;c=c141’1’ groupbeg bar n01Too sweet;c=c141’4’ n01Not sweet enough;c=c141’5’ n01No taste at all;c=c141’3’ groupend bar n01Too expensive;c=c142’1’ n01Not what I would buy;c=c142’2’ groupbeg bar n01Chocolate coating was too sweet;c=c141’7’ n01Chocolate coating was awful;c=c141’0’ groupend bar n01DK/NA;c=c(141,142)=$ $
78 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
An axis may contain up to 32 subgroups of this type, and the groups may overlap (i.e. a second subaxis may be started before the first one is finished) or they may be nested (i.e. a subaxis may contain another subaxis). The example below shows a nested subaxis for comments specifically about the taste of the chocolate coating: groupbeg taste n01Too sweet;c=c141’4’ groupbeg ctaste n01Chocolate coating was too sweet;c=c141’7’ n01Chocolate coating was awful;c=c141’0’ groupend ctaste n01Not sweet enough;c=c141’5’ n01No taste at all;c=c141’3’ groupend taste
Here is another example with overlapping subgroups: l allchoc n10Base n01Trouble undoing wrapping;c=c142’8’ n01Didn’t like plastic wrapping;c=c141’1’ groupbeg bar,sweet n01Too sweet;c=c141’4’ n01Not sweet enough;c=c141’5’ groupend sweet n01No taste at all;c=c141’3’ groupend bar n01Too expensive;c=c142’1’ n01Not what I would buy;c=c142’2’ groupbeg bar,sweet n01Chocolate coating was too sweet;c=c141’7’ groupend sweet n01Chocolate coating was awful;c=c141’0’ groupend bar n01DK/NA;c=c(141,142)=$ $
When the elements in a group are scattered throughout the axis (as in the previous example), or when an element belongs to all subaxes in the main axis, the element may be flagged with the option: group=groupnames on the element itself, where groupnames is a comma-separated list of the groups in which the element belongs.
Introduction to axes – Chapter 3 / 79
Quantum User’s Guide Volume 2
For example: l allchoc n10Base;group=all . n01Too sweet;c=c141’4’;group=sweet n01Chocolate coating was too sweet;c=c141’7’;group=sweet,coating n01Chocolate coating was awful;c=c141’0’;group=coating n01Not sweet enough;c=c141’5’;group=sweet n01No taste at all;c=c141’3’
The special group name ‘all’ is used for elements which belong in all subaxes. In our example, the Base element is to be included in all groups. An axis may contain both types of grouping, and an element may be present in more than one group. Elements which are not part of a groupbeg/end group and which do not have the group= keyword are part of the main axis only: it is not an error for an element to be omitted from all subaxes.
✎ Quantum does not allow a subaxis to be created from the elements of more than one axis. To do this, it is necessary to create a completely new axis and to copy the required elements into it.
Creating tables from subaxes To create a table using a subaxis, write a tab statement but instead of the main axis name, enter the name of the subaxis as it is defined by groupbeg or group=.
✎ When subaxes are used, the name of the main axis must be mentioned on a tab statement otherwise Quantum will skip the whole axis and will complain that subgroups have not been defined.
☞ For further information about the tab statement, see section 7.1, ‘Creating a table’.
80 / Introduction to axes – Chapter 3
Quantum User’s Guide Volume 2
3.8 Printing characters next to absolutes Quantum provides a group of keywords for printing additional characters in the cells of a table apart from the standard counts and percentages. You might find this useful for printing base figures in brackets or for printing $ or a £ signs in front of currency figures. The keywords work only with absolutes and are: figchar= figpre figpost figbracket
This defines a single character to be printed beside absolutes. This prints the figchar character before each absolute. This prints the figchar character after each absolute. This is shorthand for figpre;figpost (that is, print character before and after absolutes).
You can use these keywords on the l statement to make them apply to the whole axis or on n01, col, val, fld and bit statements to apply these facilities to individual elements. If you specify figpre, figpost or figbracket on the l statement you may turn it off for an individual element by respecifying the keyword on the element, preceded by no; for example, nofigbracket on an element turns off figbracket for that element only. The character you specify with figchar= may be a single character or a single character enclosed in dollar signs. You may choose any character you wish, but certain bracketing characters will be treated in a special way. Characters that count as bracketing characters are: ( ) { } [ ] < > If you set figchar to one of these characters and figpre and figpost are both operative, or figbracket is operative, then that character is printed before each absolute and the matching bracket in the pair is printed after them. Here is a some code and a table which illustrate this: tab cost product l cost n10Base;figchar=(;figbracket val cx(153,157);R;Less than £1.50;I;£1.50 to £1.55; +£1.56 to £1.60;£1.61 to £1.65;£1.66 to £1.70;More than £1.70=1.71+ n25;inc=c(153,157) n12Mean price paid;figchar=£;figpre;dec=2 l product col 130;Base;Brand A;Brand B;Brand C
Introduction to axes – Chapter 3 / 81
Quantum User’s Guide Volume 2
The table that this code produces is:
Base Less than £1.50 £1.51 to £1.55 £1.56 to £1.60 £1.61 to £1.65 £1.66 to £1.70 More than £.70 Mean price paid
Base (20) 17 4 3 3 4 2 £1.59
Brand A (5) 5 0 2 0 2 0 £1.60
Brand B (6) 4 1 0 1 1 1 £1.58
Brand C (4) 4 1 1 1 1 1 £1.63
If you specify figbracket but do not declare a fig-character, Quantum uses the ( symbol so that figures are enclosed in parentheses. If you tabulate two axes that have different fig-characters and a cell results that has two figcharacters specified, the column character is printed and the row character is ignored. If you import a table with fig-character into Excel (via q2cda), any value with fig-characters in it will be treated as a text cell rather than a number cell.
82 / Introduction to axes – Chapter 3
4 More about axes This chapter tells you more about the statements used in axes. Statements covered include the n00 to filter groups of rows on a specific condition, the n09 which controls the pagination of long tables, and col, val, bit and fld which in some cases provide alternatives to the n01 statement. We also discuss keywords which may be used on all row-creating statements thus increasing their flexibility.
4.1 The col statement Quick Reference To define a list of elements with codes all in the same column, type: col number;[base;] elm_txt1[=’codes1’] [;elm_txt2[=’codes2’] ... ]
If several consecutive statements in an axis have conditions defined by a code or codes in the same column, you can save yourself a lot of time and effort by replacing the individual n01 statements with a single col statement. One of the simplest col statements you can write is: col n;[base];Rtext1[=’p1’];Rtext2[=’p2’] where n is the column containing the codes for this question, base creates a base element, and Rtext1=’p1’, Rtext2=’p2’ and so on define the texts and conditions for the individual elements. To explain more clearly how the col statement works, let’s take the axis mstat that we wrote earlier and rewrite it using a col statement. Originally it consisted of five statements: n10Base n01Single;c=c109’1’ n01Married;c=c109’2’ n01Divorced;c=c109’3’ n01Widowed;c=c109’4’
We can replace these with the line: col 109;Base;Single;Married;Divorced;Widowed
The texts Single, Married, Divorced and Widowed define the element texts and their positions in the statement tell Quantum which code represents which response.
More about axes – Chapter 4 / 83
Quantum User’s Guide Volume 2
When Quantum encounters a col statement which just contains element texts, it assumes that those responses are single-coded in the order 1234567890–& and blank. Thus, in our example, Single is the first element so it is assumed to be a code ‘1’ in column 109; Widowed is the fourth element so it is assumed to be a code ‘4’ in column 109. Suppose we want to print the elements in mstat in a different order, say, Widowed, Single, Married, Divorced. We can either write each response followed by its code, thus: col 109;Base;Widowed=4;Single=1;Married=2;Divorced=3
or we can just define the code for Widowed and let Quantum assign the other codes by default. The default for the first response without a specific code is ‘1’: col 109;Base;Widowed=4;Single;Married;Divorced
However, if automatic coding has been specified, and then a single element is assigned a specific code, the remaining codes continue from where the automatic numbering left off. Therefore, if the above axis was specified as: col 109;Base;Widowed;Single;Married=6;Divorced
the first element is Widowed, so it is assigned code ‘1’, Single is code ‘2’, Married is specifically given the code ‘6’, and Divorced reverts to the automatic numbering and is given code ‘3’. The code list for col consists of 12 codes followed by blank. This means that blank is the 13th code in the list. If a col statement lists 13 responses, the code for the 13th response is blank. For example: col 234;Base;Brand 1;Brand 2;Brand 3;Brand 4;Brand 5;Brand 6; +Brand 7;Brand 8;Brand 9;Brand 10;Brand 11;Brand 12;Brand 13
The condition that Quantum applies for Brand 13 is c224’ ’. Codes may be combined to form ‘or’ conditions, just as on n01 statements. If the condition for an element is one code only, the code may be written without the single quotes. Obviously this does not apply when the code is a blank: blanks must always be enclosed in single quotes. Here’s an example showing both ways of entering codes: col 109;Base;Divorced/Widowed=’34’;Single=1;Married=2
This statement creates four elements; a base for everyone eligible for inclusion in the table, and elements for single people, married people and respondents who are divorced or widowed. Codes on col statements need not be exclusive. For example, you may write: col 110;Base;All Colors (Net)=’1/4’;Red;Blue;Green;Yellow
to create a net for a multicoded response.
84 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
You can use a user-defined data array element in place of a column in the C array. You type the variable name and the number of the column containing the data. For example: col color(1);Base;First choice (Net)=’1/4’;Red;Blue;Green; . . . col color(2);Base;Second choice (Net)=’1/4’;Red;Blue;Green; . . .
The respondent’s first choice is read from column 1 of the color array, and the second choice is read from column 2 of the same array.
✎ You are advised to enter codes for all responses in the list if the code order is anything other than 1234567890-& blank. That way you will know exactly which code represents which response straight away rather than having to look to see which codes have been assigned elsewhere.
Take care if the element text contains a semicolon. Semicolons separate the individual responses on a col statement, so if you want a semicolon to be printed as part of a text, precede it with a backslash. When the text is printed, the backslash will be replaced by a space. For example: col 157;Base;One;Two;Three;Four
creates five rows, but: col 157;Base;One\;Two=’12’;Three\;Four=’34’
generates three rows, the second of which has the text ‘One ;Two’ and the third of which is ‘Three ;Four’.
Continuing col statements Col statements may be continued using a + in column 1 of the next line. If a response will not fit on the current line, you can split the statement after a semicolon separating two responses. The continuation must not occur within a set of semicolons otherwise Quantum assumes that the continued parameter is, in fact, two items not one. For example: col 121;Base;Inner London=1;Outer London=2;England +Outside London=3
creates five rows — Base, Inner London, Outer London, England, and Outside London, which is not what we want, but: col 121;Base;Inner London=1;Outer London=2; +England Outside London=3
creates four rows, the last being England Outside London. More about axes – Chapter 4 / 85
Quantum User’s Guide Volume 2
Dealing with don’t knows Quick Reference To create an element on a col statement that counts respondents present in the base but not in any other element since then, type: col number; ... ; element_text=rej
In chapter 3, ‘Introduction to axes’ we described how to deal with Don’t Knows using the notation c=– on the n01 statement. To achieve the same thing on a col statement, we use the keyword =rej: col 121;Base;Inner London;Outer London;England Outside London; +Scotland and Wales=’45’;Don’t Know/Not Answered=rej
In this example the row entitled ‘Don’t Know/Not Answered’ will include all respondents for whom c121 is blank or contains any code other than ‘1/5’. As with c=–, rej checks back to the previous Base or, if there is no base, to the beginning of the table. If an axis contains two col statements, the first containing the word Base and the second containing the keyword rej but no base, the line with rej will contain anyone not already included by either statement.
Conditions on col statements Quick Reference To include a respondent in an element if the column contains codes for that element and no other, type: col =number; ...
The condition on an n01 statement can be any valid logical expression. This is not true for the col statement which can be used only when the conditions can be represented by the codes of one column. Nevertheless, the flexibility of col is somewhat increased by the fact that you can type = before the column number to mean ‘exactly equal to’. This is the same as writing a logical expression using cn=’p’.
☞ For further information about the = operator in logical expressions, see ‘Comparing data variables and data constants’ in chapter 5, ‘Expressions’ in the Quantum User’s Guide Volume 1. For further information about conditions on n01 statements, see section 3.3, ‘Defining conditions for an element’ in this volume.
86 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
Suppose c114 contains information about the ages of children in the household as follows: (c114) Under 5 years
1
5 - 10 years
2
11 - 15 years
3
16 - 18 years
4
If the household contains children in more than one age group, the column will be multicoded. You may wish to set up a table for people whose children are in one age group only; that is, they may have any number of children but they must all be under 5 or all aged 5 to 10; people with one child under five and one aged between 5 and 10 will be ignored. We would set up our table as: l child1 col =114;Base;Under 5;Aged 5-10;Aged 11-15;Aged 16-18
The = includes respondents who have the specified code and no other codes in c114. It is the same as writing the condition c=c114=’1’. The first row after the base will be a count of all households having children under 5 only; the next row will tell us how many households have children aged 5 to 10 only.
Bases on col statements Quick Reference To define a base element on a col statement, type: col number;base[=text]; ... If the keyword base is given by itself, the base element will be labeled ‘Base’. The keyword base creates a base row or column with the text Base, the text being printed exactly as it appears on the col statement. To have a base with a different text, follow the keyword base with an equals sign and the desired text. For example: col 230;base=All Using Brand A
will print a base row with the text ‘All Using Brand A’. Tables may also be weighted in which case any base created with base or base= will also be weighted.
☞ For information on weighting, see chapter 1, ‘Weighting’ in the Quantum User’s Guide Volume 3.
More about axes – Chapter 4 / 87
Quantum User’s Guide Volume 2
Subheadings with col Quick Reference To define a subheading element on a col statement, type: col number; hd=subheading_text; ...
The hd= option on a col statement performs the same task as an n23 in the axis. To create the axis heading ‘Marital Status’ with hd= on a col statement, we would write: col 109;Base;hd=Marital Status;Single;Married;Divorced;Widowed
Text-only elements with col Quick Reference To define a text-only element on a col statement, type: col number; tx=text ...
The option: tx=text on a col statement creates a text-only element in the axis in the same way that an n03 element does. For example: col 138;Base;hd=Color Preferred;tx=Primary;Red;Blue;Yellow; ++tx=Pastel;Pink;Lilac
When this axis forms the rows of a table, the two tx elements form text-only rows defining the types of colors which follow. When the axis is used as the columns of the table, the tx= elements are ignored.
88 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
4.2 The val statement Val is used when the conditions defining eligibility for inclusion in an element are positive numbers or ranges of positive numbers rather than codes; that is, where the question in the questionnaire requires a numeric response rather than a single or multicoded answer; for example, the number of people in the household, or the number of telephone calls made.
Testing for arithmetic equality Quick Reference To define elements whose condition is that a variable contains a specific value, type: val variable; = ;number1 [element_txt1];number2 [element_txt2] ... If the elements contain text as well as a number, the number may appear anywhere in the text. If the value is not part of the text, type: val variable; = ;element_text = number; ... The base, hd=, tx= and =rej options described for col statements are also valid on val statements of this type.
Val can be used to test whether the value of a variable is equal to a given value. If it is equal, the cell count is incremented by 1. The format is: val variable;[Base];[hd=Text];=;[tx=Text];n1 [Text1]; ... ;nn [Textn] where variable is the data, integer or real variable whose value is to be tested, n1 to nn are the values against which the variable is to be compared, and Text1 to Textn are the row descriptions to be printed in the table. The equals sign indicates that the test is for arithmetic equality rather than ranges. Base, hd= and tx= are optional and create the base, sub-heading and text-only rows of the table as described for col statements. Let’s work through an example to illustrate this. Suppose c(110,111) contains data on the number of people in the household, and we wish to set up a table showing how many respondents live in households containing 1, 2, 3, 4, 5 or 6 people, so we write: val c(110,111);Base;Hd=Number in Household;=;1 Person;2 People; +3 People;4 People;5 People;6 People
More about axes – Chapter 4 / 89
Quantum User’s Guide Volume 2
If the arithmetic value of c(110,111) is equal to 1, the respondent is included in the second row of the table (the first row is the base row). If the value is equal to 6, the respondent will fall into the row reading ‘6 People’. The text is printed exactly as it appears between the semicolons. The expression ‘One person’ is not valid because the program can’t read ‘One’. Each text has to have a number in it or associated with it so that Quantum knows what to check for. Texts may contain any characters you like except semicolons and other numbers. It may also come on both sides of the number: the parameter ‘For 5 people’ is valid. Now let’s look at the table itself (Figure 4.1). You will notice that the last row is entitled ‘Others’: it gathers together all respondents living in households of more than six people. This was created by Others=rej at the end of the val statement and collects all respondents not included in any of the previous elements. We could equally well have written an n01 statement with the condition c=–6 or just c=– to collect anyone not included in the previous six elements.
Absolutes/Row Percentages Base: All Who Bought Fabric Conditioner Brand Bought Most Often Base Brand A Brand B Brand C Others -------------------------------------------Base 190 54 50 55 31 100.0% 23.4% 26.3% 28.9% 16.3% Number in Household 1 Person 32 12 11 2 7 100.0% 37.5% 34.4% 6.3% 21.9% 2 People 82 16 14 42 10 100.0% 19.5% 17.1% 51.2% 12.2% 3 People 18 6 6 2 4 100.0% 33.3% 33.3% 11.2% 22.2% 4 People 19 6 6 5 2 100.0% 33.3 33.3% 26.3% 11.1% 5 People 9 3 1 4 1 100.0% 33.3% 11.1% 44.4% 11.1% 6 People 7 2 3 0 2 100.0% 28.6% 42.9% 0% 28.6% Others 23 9 9 0 5 100.0% 39.1% 39.1% 0% 21.7%
Figure 4.1 Creating elements with val
90 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
Sometimes, as is the case with Other, the numbers are not a valid part of the element text. Suppose c(132,133) contains codes for the brand of fabric conditioner bought most often. If c(132,133)=$77$, the brand purchased most often was Brand A, and so on. To set up the table shown above, we used an equals sign between the Brand and the number which represents it: val c(132,133);Base;hd=Brand Bought Most Often;=;Brand A=77; +Brand B=79;Brand C=81;Others=rej
If the values on the val statement are just numbers which are incremented by 1 for each element, they may be abbreviated using the notation: val c(m,n);Base;=;start:end where start is the value required for the first element and end is the value required for the last element. Note that if there are spaces between the start and end values and the colon, the range will not be recognized. When the axis is used, Quantum will create as many elements as there are numbers in the range. For example: val c(110,111);Base;hd=Number of people in household;=;1:9
will create ten elements in all: one for the base and nine for the numbers in the range 1:9. When elements are defined in this way, no element texts may be entered since Quantum will use the individual numbers in the range as the row and column texts. Usually the values for each element will be positive, but val can also cope with negative numbers. If the data contains three records: -10 -0010 10
the val statement: val c(1,5);=;-10;0;10
will report that there are two records with the value –10, and one with the value 10.
More about axes – Chapter 4 / 91
Quantum User’s Guide Volume 2
Testing ranges Quick Reference To define elements whose condition is that a variable contains a value within a given range, type: val variable; i ;min1–max1[element_txt1];min2–max2[element_txt2] ... if the maximum value in the range is to be included in that range, or: val variable; r ;min1–max1[element_txt1];min2–max2[element_txt2] ... if it is not. If the elements contain text as well as ranges, the range may appear anywhere in the text. Ranges which are not part of the element text may be entered after the text and separated from it by an = sign. The base, hd=, tx= and =rej options described for col statements are also valid on val statements of this type.
Val may be used to test whether the value of any variable (data, integer or real) is within a given range. The format is almost identical to that for testing equalities, except that the equals sign is replaced by I or i for inclusive ranges (the maximum value is part of the range) or R or r for exclusive ranges (the maximum is not part of the range): val variable;[Base];[hd=text];I|i|R|r;[tx=text[;range1 [text1];range2 [text2]; ... Ranges are entered as the minimum and maximum values separated by a hyphen (min-max) or slash (min/max). If no upper value is given, a maximum of infinity is assumed. Thus we might have: val c(110,111);Base;hd=Size of Household;I;1-2 People; +3-4 People;5-6 People;7 or More People
If the value in c(110,111) is in the range 1-2, the respondent is included in the element entitled ‘1-2 People’; if the value in c(110,111) is 10, he or she is included in the element ‘7 or More People’. Note that all ranges are inclusive because we have used the i operator. The r operator may be used to indicate that the maximum value specified is not part of the range. We might have: val liters;Base;hd=Liters Bought Per Person;R;0-10.5 Liters; +10.5-20.0 Liters;20.0-35.5 Liters;35.5 or More Liters
92 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
In this situation, the first element will contain the number of households in which the number of liters bought was between 0 and 10.4999 per person; the second will contain the number of households in which the number of liters purchased per person was between 10.5 and 19.9999, and so on. The last element will include all households in which the number of liters per person is 35.5 or more. Where the numbers defining the ranges are not part of the element texts, the text may be entered followed by an equals sign and the range specification, as described in the previous section.
✎ When defining ranges in element texts, an actual range must be specified, for example, 10-20 or 25-50. It is not enough to say, under 25, for example as this will be interpreted as 25-99.
If both numbers in a range are negative, the smaller value (i.e., the one farthest away from zero) must come first. For example: val c(1,5);i;-10--5;-4-0;1-10
Combining arithmetic equality and range testing The operators =, I and R may be combined in one val statement, as follows: l hshld val c(110,111);Base;hd=Size of Household;=;1 Person;2 People; +I;3-4 People;5-6 People;7-8 People;9 or More People
✎ If you combine an i or r operator with elements that specify a single value only, Quantum reads those values as open-ended ranges. For example, if you write: val c120;i;Male=1;Female=2
Quantum increments the count for Male every time it finds a value of 1 or greater in c120, and the count for Female every time it finds a value of 2 or greater. To correct this example you would replace the i operator with the = operator.
Remember that a full range must be defined to obtain a correct calculation. For example, the statement: l age val c(101,102);i;Under 29 years;30-40;41 or over
would give an incorrect value. This is because Under 29 would be interpreted to mean anyone between 29 and 99 years and 41 or over would also match anyone over 41. The Under 29 element should be redefined as a range; for example: val c(101,102);i;Under 29 years=18-29;30-40;41 or over
More about axes – Chapter 4 / 93
Quantum User’s Guide Volume 2
Counting missing values Records whose values are missing_ fail all the standard conditions on a val statement. To create an element on a val statement that counts missing values, enter the condition as missing_. For example: l rental val c(9,10);Base;i;None=0;1-5;6-10;11-20;21-30;31+; +=;DK/NA=missing_
Here, the DK/NA element counts any record in which c(9,10) is not numeric.
4.3 Responses with numeric codes: fld Quick Reference To define elements whose condition is that a field contains a specific numeric code, type: fld column_specs;element_txt1[=code[,code ...] ]; ... The base, hd=, tx= and =rej options described for col statements are also valid on fld statements.
Most of the data you tabulate consists of codes in columns. Each code in each column represents a different response. For example, if the questionnaire shows: Q6A: Which films did you see on your last three visits to the cinema? (12) (13) (14) Columbus .................... 1 1 1 Aliens 3 .................... 2 2 2 Pretty Woman ................ 3 3 3 Green Card .................. 4 4 4 Batman 2 .................... 5 5 5
and the respondent saw Columbus, Green Card and Aliens 3, you could count the number of respondents who saw Columbus by writing an n01 statement: n01Columbus;c=c12’1’ .or. c13’1’ .or. c14’1’
Alternatively, you could use integer variables in the edit and set each one to 1 if the respondent saw the film. The n01 statement might then be: n01Columbus;c=t1 .gt. 0
94 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
Now suppose that the films are coded with two-digit numeric codes instead. The questionnaire shows: Q6A: Which films did you see on your last three visits to the cinema? (12-13) (14-15) (16-17) Columbus .................... 01 01 01 Aliens 3 .................... 02 02 02 Pretty Woman ................ 03 03 03 Green Card .................. 04 04 04 Batman 2 .................... 05 05 05
The n01 for Columbus would be: n01Columbus;c=c(12,13)=$01$ .or. c(c14,15)=$01$ .or. c(16,17)=$01$
There is nothing wrong with writing statements of this type if this is what you want. However, Quantum offers the choice of using either a fld statement in the axis, or a combination of a field statement in the edit and a bit statement in the axis as a means of avoiding long conditions of this type.
✎ The fld statement counts the number of respondents who gave each response and not the number of responses that were given.
fld is like a col or val statement because a single statement can create a number of elements. The format of a fld statement is as follows: fld col_specs;[base[=btext]];[hd=hdtext];[tx=text];element_specs The options base, base=, hd= and tx= define base elements, subheadings and text-only elements as they do with col and val statements. The column specs on a fld statement define the columns to be read. There are three ways of entering them. First, you may list each column or field reference one after the other, separated by commas. The list must be enclosed in parentheses. In our example this would be: fld (c(12,13), c(14,15), c(16,17))
Second, if you have sequential fields as you do here, you can type the start columns of each field followed by the field length. The list of start columns is separated by commas and enclosed in parentheses, and the field length comes after the closing parenthesis and starts with a colon. If you use this notation for the film example you would write: fld (c12, c14, c16) :2
More about axes – Chapter 4 / 95
Quantum User’s Guide Volume 2
If you wish, you can abbreviate this further by typing just the start columns of the first and last fields, followed by the field length. This time you do not use parentheses: fld c12, c16 :2
Third, if the fields are not sequential, you may list the start columns and field width of each group of columns (as shown above) and separate each group with a slash. For example, to read data from columns 12 to 17 and 52 to 57, with each field being two columns wide, you would type: fld c12, c16 / c52, c56 :2
This reads c(12,13), c(14,15), c(16,17), c(52,53), c(54,55) and c(56,57). You can also use this notation for single non-sequential fields. For example: fld c23 / c36 / c71 :2
means c(23,24), c(36,37) and c(71,72). The element specs part of the statement defines the element texts and the codes which represent those responses. If you enter element texts by themselves, Quantum assumes that the first text is code 1, the second text is code 2, and so on. The codes apply to all fields named in the column specs part of the statement. Therefore, to define elements which will count the number of people who saw each film, you would write: fld (c12, c14, c16) :2;Columbus;Aliens 3;Pretty Woman; +Green Card;Batman 2
Remember that there are several ways of defining the columns: this example is not the only way you can write this statement. If the response codes are not sequential, or you do not wish to list them in sequential order, you must follow the element text with an equals sign and the code number. You can allocate a number of codes to one element by listing them separated by commas; if the codes are a range, type the first and last codes separated by a hyphen. For example: fld (c12, c14, c16) :2;Science Fiction/Fantasy=2,5;Historical=1; ++Others=3-4
When you type codes in this way, Quantum checks that none of the codes is longer than the given field lengths, and flags any which exceed the field length with an error message. In our example, fields are two columns long so Quantum will reject codes greater than 99 and strings longer than two characters.
96 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
When the field you are testing has more than one column, the numeric data must be right-justified for Quantum to recognize it correctly. So in the two-column field in our example, Quantum recognizes the following codes as 1: 01 1
But Quantum does not recognize the following codes as 1 and these codes are ignored: 1 10
If you have responses such as No Answer or Don’t Know with non-numeric codes, type the code enclosed in dollar signs, as shown below: fld (c12, c14, c16) :2;Columbus;Aliens 3;Pretty Woman; +Green Card;Batman 2;None of these=$&&$
You may specify an element to gather responses not counted since the last base by typing an element with the value =rej as you would on a col or val statement.
4.4 Responses with numeric codes: bit Quick Reference To define elements whose data is to be read from an integer array created in the edit section, type: bit array_name; element_text1;element_text2; ...
Using the statements field and bit together has the same effect as fld. You would use them when you want to reorganize or otherwise manipulate the data before tabulating it.
☞ You’ll find a full explanation of field in section 8.6, ‘Reading numeric codes into an array’ in the Quantum User’s Guide Volume 1, but we’ll explain it briefly here so you can see exactly how it relates to bit.
More about axes – Chapter 4 / 97
Quantum User’s Guide Volume 2
field is an edit statement that counts the number of times a particular code appears in a list of fields for each respondent. It stores these counts in an integer array that consists of as many cells as there are fields to count. For example, if the questionnaire contains the question and response list: Q6A: Which films did you see on your last 3 visits to the cinema? (12-13) (14-15) (16-17) Columbus .................... 01 01 01 Aliens 3 .................... 02 02 02 Pretty Woman ................ 03 03 03 Green Card .................. 04 04 04 Batman 2 .................... 05 05 05
you could use field to count the number of times each film was seen by each respondent. If you call the array films, films1 would contain the number of times that the respondent saw Columbus, films2 would contain the number of times that he or she saw Aliens 3, and so on. If the respondent did not see a film, the cell for that file will be zero. To tabulate data counted by a field statement, you use bit: bit input_array; element_specs The input_array is the name of the integer array you created with field, and element_specs are the element texts and codes. The rules for defining elements with bit is the same as for fld, so you could tabulate the films by typing: bit films;Columbus;Aliens 3;Pretty Woman;Green Card;Batman 2
Quantum will increment the count for Columbus by 1 whenever cell 1 of the films array is greater than zero. The value of a cell in the array has no bearing on the number by which Quantum increments the element count. As long as the cell value is greater than zero, Quantum increments the element count by 1. It does not increment the element count by the cell value; that is, it counts the number of respondents and not the number of responses.
✎ If you want to count the number of responses, rather than the number of respondents you need to use the inc= option in the bit statement.
☞ For further information, see the following section, ‘When bit is better than fld’. You can group and re-order responses in the same way as with fld. For example: bit films;Science Fiction/Fantasy=2,5;Historical=1;Others=3-4
Quantum will increment the count for Fiction/Fantasy whenever cells 2 and/or 5 are non-zero; it will increment the count for Historical whenever cell 1 is non-zero; it will increment the count for Others whenever cells 3 and/or 4 are non-zero.
98 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
bit does not allow detailed analysis of out-of-range or non-numeric codes. The field statement counts out-of-range codes (for example, a code 6 or 7 when the array contains five cells) in cell zero which Quantum creates for itself. Non-numeric codes such as $&&$ for ‘None of these’ are stored in a cell which you define as part of the field statement. If you want to include these types of responses in the axis, you may do so with an element of the form Out of range=rej. bit allows use of the keywords base, base=, hd= and tx=. These are as described for fld.
When bit is better than fld When you have numeric codes and you want simple counts of respondents, it is quicker and easier to use fld than it is to use field and bit. However, if you want to count the number of times each film was seen, for example, you will need to increment the elements of the axis by the number of times each response code appears. Normally you’d use inc= to name the column or field to use as the increment, but with fields of numeric codes this is not possible. This is where you’d choose field and bit instead of fld, because Quantum has already done some of the work for you. You’ll remember that field increments cells of the array each time it finds a particular code. If code 01 appears in the list of fields twice, the value in cell 1 will be 2. This is the value by which you want to increment the element count, so you write a bit statement which tells Quantum to do just that. If you want an axis that shows the number of times each film was seen, you will write the bit statement as: bit films;Base;Columbus;%inc=films1;Aliens 3;%inc=films2; +Pretty Woman;%inc=films3;Green Card;%inc=films4; +Batman 2;%inc=films5
If we assume that all respondents are eligible for inclusion in this axis, the base will be the total number of respondents, even though a cell may be incremented by more than one per respondent.
☞ For information on inc=, see ‘Data options’ later in this chapter.
Incrementing tables more than once per respondent In the previous section you saw how bit provides an quick and easy method of updating the cells in a table by more than one per respondent. In the example, the cells of the table will show the number of viewings per film, but the base will show the number of respondents eligible for inclusion in the table.
More about axes – Chapter 4 / 99
Quantum User’s Guide Volume 2
Although a table of this type immediately highlights films which were seen more than once per respondent, there may be times when you want the base to be calculated on the same basis as the rest of the table; that is, it should be a count of viewings rather than of respondents. To obtain a table of this type you need to increment the base once per field rather than once per respondent. This means reading and tabulating one field at a time. The statement which lets you do this is process. This is an edit statement which sends the record temporarily to the tabulation section. Let’s rewrite the films example using process and compare the results with the ones we obtained using bit.
☞ For full details on process and further examples, see section 9.10, ‘Going temporarily to the tab section’ in the Quantum User’s Guide Volume 1.
In the edit we write a loop which copies the contents of each field in turn into some spare columns and then sends the record to the tabulation section for analysis. Since we do not want all tables to be incremented more than once per respondent, we set a flag in another spare column which we can use as a filter on the table which requires the extra updating. The edit is: ed /* set a flag for use as filter in tab section c181=’1’ /* take each field in turn do 5 t1 = 112,116,2 if (c(t1,t1+1)=$ $) go to 5 c(182,183) = c(t1,t1+1) /* skip to tab section process /* back from tab section, so try the next field 5 continue /* reset filter flag for other tables c181=’ ’ . end
100 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
In the tabulation section, we write: /* filter table so it’s only updated for process fields tab filmax region;c=c181’1’ ttlBase: Number of Viewings /* remove filter for all other tables flt;c=c181’ ’ tab ax1 bk1 . l filmax fld (c(182,183));Base;Columbus;Aliens 3;Pretty Woman; +Green Card;Batman 2;None of these=$&&$
The record passes through the entire tabulation section but only tables in which the spare column contains a ‘1’ are updated. Once all fields have been dealt with, the edit resets this column to blank so that when the edit finishes Quantum can create the other tables in the usual way. To compare the results of using bit and process, let’s take the record: 0 ---+--- 1 020402
Base Columbus Aliens 3 Pretty Woman Green Card Batman 2 None of these
With bit and inc= 1 0 2 0 1 0 0
With process 3 0 2 0 1 0 0
The counts for the individual films are the same with both methods. bit and inc increment each table cell by the value of the film’s cell in the array but, because the record passes through the tabulation section once, the base is incremented only once per respondent. With process the record passes through the tabulation section once per film; the base and the individual film counts are incremented each time this happens.
More about axes – Chapter 4 / 101
Quantum User’s Guide Volume 2
4.5 Filtering within an axis Quick Reference To define a condition that applies to a group of consecutive elements, type: n00;c=logical_expression
Often you will have a condition that applies to a group of rows in a table, in addition to the individual row condition. There are two ways of dealing with this. One way is to make each row condition an ‘and’ condition by combining the global condition with the row condition, for instance: n01First Row;c=c136’1’.and.c140’1’ n01Second Row;c=c136’1’.and.c140’235’
The other is to enter the global condition separately using an n00 (N-zero-zero) statement. An n00 defines a condition applicable to all subsequent rows until another n00 is read or until the end of the axis, whichever is the sooner. Its format is: n00[;c=condition] where the condition is any valid logical expression. One of the most frequent uses of this statement is in tables which show whether or not a respondent liked a particular product, and then lists reasons why he did or did not like it. For example, the axis: l pref1 col 321;Base;Liked Product;Disliked Product;DK/NA=rej n03 n00;c=c321’1’ col 322;hd=Reasons for Liking Product;Cleans Well; +Lasts a Long Time;Smells Nice; .... n03 n00;c=c321’2’ col 325;hd=Reasons for Disliking Product;Inconvenient to Use; +Too Expensive; ....
has three sections, each one separated by a blank line (n03). The first tells us how many respondents liked the product (c321’1’) and how many disliked it (c321’2’). So that we include all eligible respondents in this section, we set up the third row to include anyone who does not have a 1 or a 2 in that column. These would be people who did not have a preference or who refused to answer the question.
102 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
The second section deals only with those who said they liked the product, so we have used the n00 to exclude everyone else. Use of an n00 here is efficient as regards your time and the computer’s: without it, you would have had to write one statement for each reason, with each reason having a complex condition, as shown previously. The third section is exactly the same as the second, except that it includes respondents who did not like the product. In this example, the first filter was turned off by another n00 defining a new filter, and the second was terminated by the end of the axis. To turn off a filter before the end of the axis without defining a new filter, enter an n00 without a condition. This causes all respondents to be eligible for inclusion in the following elements.
4.6 Redefining a base Tables may contain several base elements. The most common occurrence of a second or redefined base is in preference tables as in the example above. Percentages for the products themselves are calculated using the number of respondents eligible for inclusion in the table, while percentages for the reasons for preference are generated using the number of people preferring that product as a base. If you wish, you can also have the reasons for preference percentaged against the table base. This is done with the option op=6 on the a, flt or tab statement.
☞ For further information about output types, see ‘Output options’ in chapter 2, ‘The hierarchy of the tabulation section’.
When the two sets of percentages are printed, the percentage against the redefined base (e.g., all preferring product A) will be printed on the line immediately beneath the absolute figures, with the percentages against the table base on the line below. Figure 4.2 provides an example. The table is created by the statement: tab pref region;op=126
where pref is as follows: l pref col 145;Base;hd=Product Preferred;Brand A;Brand B;Brand C n00;c=c145’1’ col 146;Base=All Preferring A;Cleans Better;Pleasant Smelling; +Lots of Bubbles; ... n00;c=c145’2’ col 146;Base=All Preferring B; ....
More about axes – Chapter 4 / 103
Quantum User’s Guide Volume 2
Detergent Survey
Page 13 Absolutes/Col Percentages
Base: All Respondents Base ---282
Base Product Preferred Brand A
North ----78
Region South ----81
East ---57
West ---66
110 39.0%
37 47.4%
42 51.9%
21 36.8%
10 15.2%
Brand B
95 33.7%
15 19.2%
28 34.6%
15 26.4%
37 56.1%
Brand C
77 27.3%
26 33.4%
11 13.5%
21 36.8%
19 28.7%
110
37
42
Cleans Better
50 45.5% 17.7%
13 35.1% 16.7%
20 47.6% 24.7%
11 52.4% 19.3%
6 60.0% 9.1%
Pleasant Smelling
27 54.0% 9.6%
9 24.3% 11.5%
12 28.6% 14.8%
5 23.8% 8.8%
1 10.0% 1.5%
Lots of Bubbles
33 30.0% 11.7%
15 40.6% 19.2%
10 23.8% 12.4%
5 23.8% 8.8%
3 30.0% 4.5%
95
15
28
All Preferring A
All Preferring B
21
15
10
37
.
Figure 4.2 Using n00 as a filter in an axis There are, of course, several minor variations which would work just as well: for example, in place of the n00s and the Base parameters on the col statements we could use n10s with conditions on them. However, this would mean replacing the cols with separate n01s for each element and adding the condition to each of those statements as well. Alternatively, since the same col statement applies to all brands and the n00 is almost the same, we could put them in a separate file and include it in the relevant places with an *include statement.
104 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
☞ For further information about the inclusion of files in this way, see chapter 10, ‘Include and substitution’.
4.7 Pagination When a table is too large to fit on a single page, Quantum starts a new page automatically. If you wish to have more control over where pagination occurs you may insert statements in the axis marking points at which a new page must always be started, or points at which a new page should be started if there is insufficient room for a given number of lines.
Automatic pagination If the row axis is too long for the page, Quantum prints as much as will fit on the first page and then reprints the column headings at the start of the next page before printing the rest of the row axis. If the column axis is too wide for the page, Quantum prints the full row axis with as much of the column axis as will fit on the first page. It then starts a new page and reprints the row axis with the remainder of the column axis. Quantum repeats the table headings and the base row or column, as appropriate, before printing the rest of the table. Any texts created by foot and bot statements are also carried forward. The table number will remain the same, but the page number will be increased by 1.
☞ For further information about foot, see section 8.3, ‘Printing text at the foot of a table’. For further information about bot, see section 8.4, ‘Printing text at the bottom of a page’.
When a table is very large and has both its row and column axes split across pages, Quantum normally prints all the pages which make up the full column heading before it prints those containing the continuation of the row axis. For example, if the table spec is: tab age region l age val c(110,111)Base;11-20 yrs;21-34 yrs;35-54 yrs;55+ yrs l region col 112;Base;North;North East;NorthWest;East;West;South; +South East;South West;Central
and each page has room for five columns and three rows, Quantum prints the table in the following order:
More about axes – Chapter 4 / 105
Quantum User’s Guide Volume 2
Page 1 Base
North
North East
North West
East
Base 11-20 yrs 21-34 yrs --------------------------------------------------------------Page 2 South South West South East West Central Base 11-20 yrs 21-34 yrs --------------------------------------------------------------Page 3 North North Base North East West East Base 35-54 yrs 55+ yrs --------------------------------------------------------------Page 4 South South West South East West Central Base 35-54 yrs 55+ yrs ---------------------------------------------------------------
106 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
To alter the pagination so that rows take precedence over columns, place the keyword rinc (short for ‘rows in columns’) on the a, flt, sectbeg or tab statement. The order of printing for our example would then be: Page 1 Base
North
North East
North West
East
Base 11-20 yrs 21-34 yrs --------------------------------------------------------------Page 2 North North Base North East West East Base 35-54 yrs 55+ yrs --------------------------------------------------------------Page 3 South South West South East West Central Base 11-20 yrs 21-34 yrs --------------------------------------------------------------Page 4 South South West South East West Central Base 35-54 yrs 55+ yrs ---------------------------------------------------------------
More about axes – Chapter 4 / 107
Quantum User’s Guide Volume 2
Manual pagination Quick Reference To override automatic pagination in long axes with your own page breaks, type: n09 [continuation_text] [;hug=num_elms] [;options] hug= defines an optional page break which should take place if there is insufficient room for num_elms elements on the current page.
To override the automatic page turnover within an axis, insert the statement: n09[Text] at the point at which a new page is required. Text is an optional text which will be printed beneath the table headings at the top of the next page. Quantum always honors n09 elements in row axes. If the axis is used as a column axis, Quantum starts a new page at the n09 if the full set of column headings is too wide for the page. You may change this for an individual n09 using the keywords norow and col. Use norow to suppress the page break when the axis is a row axis; use col to force a page break when the axis is a column axis. In the example below Quantum prints the sex and age columns on different pages even though there would be room to print them side by side on the same page. l agesex col 109;Base;Male;Female n09;col val c(110,111);I;11-20 yrs;21-34 yrs;35-54 yrs;55+ yrs
The presence of n09 in an axis turns off the automatic page throw for the whole axis, so in long axes you may need to insert more than one n09 statement to get the required pagination.
✎ If you use hitch or squeeze in conjunction with n09, Quantum ignores the n09s and prints your tables depending on the value assigned to the hitch and squeeze keywords.
☞ For further information about hitch and squeeze, see section 7.6, ‘Printing more than one table per page’.
An alternative to forced page throws is to say that a new page is necessary if there is not room for a given number of lines at the bottom of the page. To do this, add the option hug=n to the n09, where n is the number of lines still needed at the bottom of the page. For example: n09Continued;hug=5
108 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
will start a new page if there is not room for five more lines on the current page. The new page will have the heading ‘Continued’ in the top left-hand corner with the table titles. When Quantum reads hug= and decides whether or not to start a new page, it counts all elements which would normally be printed, even if in this particular table they are suppressed by options such as those in the nz or smsupp groups. This count includes n23s and n03s if the axis is a row axis, and n23s if the axis is a column axis (n03s are ignored in column axes). Elements such as n15 which are never printed are not counted at all.
✎ As with automatic page turnovers, n09 prints a base row before continuing with the next line of the table. To suppress the base, follow the n09 with an n11.
A limited set of options is available for n09 statements — these are discussed below.
Repeating elements on continued tables Quick Reference To flag elements for printing at the top of continuation pages in addition to, or instead of, the table base, include the option: hold=position on those elements, where position is a number between 1 and 9 indicating the position in which that element is to be printed in relation to other held elements.
When a table is too long to fit onto one page, the base is automatically printed as the first row of all subsequent pages of the table. By flagging elements in the row axis with the option hold=n, you can determine which other elements should be printed in addition to or instead of the base. This option may appear on any n statement, or an equivalent. The value of n may be between 1 and 9, with elements with lower values being printed before those with higher values. If two or more elements have the same hold value, the most recent one before the page break supersedes any previous elements with that value. The default for non-base elements is no hold at all; the default for bases is hold=0 which causes them to be printed at the top of the table before any other held items. You may place your own hold value on base elements to override the default.
More about axes – Chapter 4 / 109
Quantum User’s Guide Volume 2
Here is an example: l likes n10Base n01Unweighted base;hold=1 n03Color;hold=2 col 123; Color comments ...... n03Flavor;hold=2 col 126; Flavor comments ..... n03Packaging;hold=2 col 129; Packaging comments .... n03Other comments;hold=2 col 132; Miscellaneous comments
In a table created with this axis as the row axis, the base and the unweighted base will be printed at the top of every page of the table. Each of the subcategories in the axis has the option hold=2. This means that only the current category heading will be printed at the top of the continuation page. So, if the table breaks in the middle of the flavor category, the Flavor heading will appear underneath the two base elements at the top of the next page. The Color category is finished, so its hold flag has been overridden; the Packaging and Other comments categories have not yet been reached so their flags have not been set. In a sorted table of nets specified as follows: l likes;sort n10Base net1Color;hold=2 col 123; Color comments ...... n03 net1Flavor;hold=2 col 126; Flavor comments ..... n03 net1Packaging;hold=2 col 129; Packaging comments .... netend1 n03Other comments;hold=2 col 132; Miscellaneous comments
the n03s before the nets will hug with the nets when the hold flags are assigned. This can cause unwanted blank lines to appear at the top of continued tables. To prevent this, place nosort on the n03s before the nets.
110 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
Quantum starts a new page when: •
There is no room on the current page for the row about to be printed. Quantum looks at the hold value on that row, if any, and cancels any previously held rows with that value.
•
An n09 is encountered, or an n09;hug= with insufficient space on the current page for the hug= to be satisfied. Quantum looks at the hold value of the row immediately after the n09 and cancels any previously held elements with that value.
•
An n23 is encountered with insufficient room on the page for the n23, any following text-only rows, and the next row containing figures. First, Quantum looks at the hold value, if any, on the n23 and cancels the previously held rows at this level. Then it looks at the row containing figures. If this is a base with the default hold=0, it cancels the previous row at that level; if not, it doesn’t cancel any hold= value associated with that row.
In all cases, Quantum then prints the table headings and any held rows, followed by the row about to be printed. Finally, it puts the hold= in force for this row. In the situations described in the second and third bullet points, Quantum does not distinguish between printing and non-printing rows when looking ahead. Once hold is in force at a given level, the only way to cancel it is to introduce a new hold at that level. To cancel a hold without generating a new printing element, enter a statement of the form: n03;hold=n;norow
where n is the hold level to be canceled.
More about axes – Chapter 4 / 111
Quantum User’s Guide Volume 2
4.8 Options on n, col, val, fld and bit statements Options may be used on n01, n15, n10, n11, col, val, bit and fld statements to define more specifically when and how a row should be printed. In many cases, an axis, table, filter or run-level option may be switched off by entering the appropriate keyword on the element, preceded by the letters no. For example, if you have applied a scaling factor to the table as a whole, you may switch it off for a single element by placing the keyword noscale on the statement which defines that element. A small subset of these options may be used on n03, n23 and n09 statements: [no]sort
subsort
unl
[no]row
[no]col
[no]high
all of which are described below. The options: [no]row
[no]col
are also valid on n25 statements. When used on an n statement, options are listed after the row text and are separated from it and each other by semicolons: n01First Row;c=c132’1’;fac=2; ... n01Second Row;nohigh
whereas on a col or val statement the option follows the relevant row text, still separated by a semicolon, but also preceded by a percent sign: col 121;Base;First Row;%fac=2-1;Second Row;%nohigh val t12;Base;=;10;%nz;20;%norow
Where an option appears on an element and also at a higher level (that is, a, sectbeg, flt or tab), the option on the element will always override the same option at the higher level. Thus, dec=2 on an n01 will override dec=1 on the a statement for that element only.
✎ Where conflicting options appear on the row and column axes of a table, the column option takes precedence.
112 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
Output options Output options determine how the axis will be printed in the tables. They have nothing to do with how the counts in the tables are created. base
Indicates that the row or column should be used as a base for percentaging.
colwid=n
This option defines the column width for this element when the axis is used as a breakdown (banner) and column widths are not set with p statements.
☞ For further information about using axes to create columns, see chapter 6, ‘Using axes as columns’.
dec=n
Determines the number of decimal places for absolute figures in this element. The default is dec=0.
decp=n
Sets the number of decimal places for percentages when op=0, 2, 7, or &. The default is decp=1.
dsp
This leaves one blank line between each row of data in a table. Without this, one line follows directly underneath another.
dummy
Defines a dummy element used to ‘pad’ the axis to the size required to accommodate the final table. This may be used when two or more tables of different sizes are added together with the add statement. Dummy is only valid on n01 and n15 statements.
☞ For further information about adding tables, see section 7.1, ‘Creating a table’. endnetn
Identifies the last element to be included in a net at level n. If endnet terminates nets at more than one level, the level number must be that of the highest level.
☞ For further information about netting, see section 3.6, ‘Netting’. endsort
Denotes the end of a group of rows to be sorted within the axis. If a row terminates more than one level of sorting, the notation endsort=n must be used, where n is the number of levels terminated.
☞ For further information about sorting, see section 6.3, ‘Sorting tables’ in the Quantum User’s Guide Volume 3.
More about axes – Chapter 4 / 113
Quantum User’s Guide Volume 2
export
Specifies that the element is to be exported to SPSS or SAS. Most elements are exported by default, but Quantum assigns the noexport option to certain types of elements. These are: •
All base elements — that is where Base is specified on col, val, var, n10, n11 statements and nxxx;base elements.
•
n25 and n31 elements.
•
nsw and n15 elements that are generated automatically.
•
n01;dummy elements.
•
Elements that do not have a condition applied — no c= and no n00 filtering is applied.
If you want to export these elements to SPSS or SAS, you need to set the export option. figbracket
Prints the character defined with figchar in front of each absolute, and prints the corresponding closing bracket after each absolute.
☞ For further information on the fig group of options, see section 3.8, ‘Printing characters next to absolutes’. figchar=
Defines a character to be printed before and/or after absolutes.
figpre
Prints the character declared with figchar= in front of each absolute value.
figpost
Prints the character declared with figchar= after each absolute value.
group=
Names the subgroup(s) to which the element belongs. If the element is part of more than one group, the group names must be separated by commas.
hold=
When a table is too long to fit onto one page, the base is automatically printed as the first row of all subsequent pages of the table. hold=n allows you to select other elements to be printed on continuation pages in addition to, or instead of, the base. This option may appear on any n statement, or an equivalent. The value of n may be between 1 and 9, with elements with lower values being printed before those with higher values. If two or more elements have the same hold value, the most recent one before the page break supersedes any previous elements with that value. The default for non-base elements is no hold at all; the default for bases is hold=0 which causes them to be printed at the top of the table before any other held items. You may place your own hold value on base elements to override the default.
☞ For an example and further information, see ‘Repeating elements on continued tables’ earlier in this chapter.
114 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
id=name
Assigns an identity code of up to six characters for use in row or table manipulation.
☞ For further information about manipulation, see chapter 2, ‘Row and table manipulation’ in the Quantum User’s Guide Volume 3. indent=n
Defines the number of spaces by which the second and subsequent lines of a long element text should be indented when it is broken by Quantum. n may be any number between 1 and 7; the default is 0.
nocol
Indicates that the element should be ignored if the axis is used as a breakdown axis. This is the default for n25 elements. To print these elements in a table add the option col to the n25 statement.
noexport
Prevents the element from being exported to SAS or SPSS. This means that during the export: •
The element will not count towards determining whether an axis is singlecoded or multicoded.
•
If the axis is single-coded, records for this element will be assigned the missing value.
•
If the element is part of a multicoded axis, no variable will be generated for the element.
•
If noexport is assigned to every element in an axis, Quantum will not generate any variables for the axis.
Generally, noexport has the same effect as if the element never existed. However, the elements still affect the values that are assigned to single-coded variables — their values are assigned, they just never appear. By default, Quantum automatically assigns the noexport option to certain types of elements. These are: •
All base elements — that is where Base is specified on col, val, var, n10, n11 statements and nxxx;base elements.
•
n25 and n31 elements.
•
nsw and n15 elements that are generated automatically.
•
n01;dummy elements.
•
Elements that do not have a condition applied — no c= and no n00 filtering is applied.
If you want to export these elements to SPSS or SAS, you need to set the export option. nohigh
Ignores the element when the axis is used as a third or higher dimension.
More about axes – Chapter 4 / 115
Quantum User’s Guide Volume 2
nontot
(or ntot). Excludes this element from totals created by n04 or n05 statements, averages created by n07 statements, and the statistics described in chapter 4, ‘Descriptive statistics’ and chapter 5, ‘Z, T and F tests’ of the Quantum User’s Guide Volume 3. This option does not exclude the element from n12 (mean), n13 (sum of factors), n17 (standard deviation), n19 (standard error) and n20 (sample variance) elements, or from the special T statistics described in chapter 7, ‘Special T statistics’ of the Quantum User’s Guide Volume 3 when they are performed in Quantum. However Windows-based Quanvert only performs special T statistics on ntot columns if id= is specified on the element when it is defined in Quantum.
☞ For further information about n04, n05 and n07, see chapter 5, ‘Statistical functions and totals’. norow
When this is used, the element is ignored when the axis is used as a row axis. This is the default for n25 elements. To print these elements in a table add the option row to the n25 statement.
nosort
Indicates that the row is not to be sorted with the other rows in the axis or group.
☞ For further information about sorting, see section 6.3, ‘Sorting tables’ in the Quantum User’s Guide Volume 3. notstat
Exclude this element from the special T statistics. This is the default for n10, n11 and their equivalents on col, val, bit and fld statements.
nz
Indicates that the element should not be printed if all its cells are zero. Elements that contain nonprinting cells that are not blank are suppressed as long as all the printing cells are blank. This means that if you have an element that is all blank apart from a non-printing base column that is suppressed by nocol, the row element will be suppressed. Which statement you put nz on depends on what you want to suppress: •
To suppress zero data elements, but not text-only elements, put nz on the tab statement.
•
To suppress specific elements if they are zero, put nz on those individual data elements.
116 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
op=n
•
To suppress individual text-only elements if the entire following section of data elements is suppressed (by nz, smsups and so on), put nz on those individual text-only elements.
•
To suppress specific elements if they are zero and individual text-only elements if the entire following section of data elements is suppressed, use nz on the l statement. If you then want to print a specific text-only element, you can use nonz on that element.
The same as op= on an a statement.
☞ For further information about the output options for the a statement and below, see ‘Output options’ in chapter 2, ‘The hierarchy of the tabulation section’. pcpos=
Defines how percentages should be printed in relation to absolutes.
☞ For further information about pcpos, see ‘Output options’ in chapter 2, ‘The hierarchy of the tabulation section’. scale=n
Defines a scaling factor by which all values in the element must be multiplied before printing. To have elements divided by a given value, the notation is scale=/n. For instance, scale=/100 will divide all numbers by 100 before printing them.
smsupa=n
Suppress the element if all absolutes are below the given value. At least one of the options smcol or smrow must also be present on the a, sectbeg, flt or tab statement to determine which types of elements in the table are affected.
smsupp=n
(or smsupc=n). Suppress the element if all column percentages are below the given value. At least one of the options smcol or smrow must also be present on the a, sectbeg, flt or tab statement to determine which types of elements in the table are affected. When columns are suppressed in an axis whose column headings are defined on g statements, Quantum ignores the g statements and creates its own column headings using the texts defined on the elements themselves.
☞ For more information on defining column headings on g statements, see chapter 6, ‘Using axes as columns’. smsupt=n
Suppress the element if all total percentages are below the given value. At least one of the options smcol or smrow must also be present on the a, sectbeg, flt or tab statement to determine which types of elements in the table are affected.
More about axes – Chapter 4 / 117
Quantum User’s Guide Volume 2
smsup+
Creates an element which includes the sum of all elements suppressed by the smsup group of keywords, in addition to any other records which normally belong in that element. Suppressed elements are collected from the start of the axis, the most recent base, or the most recent smsup+ element, whichever is the most recent. Elements suppressed after the smsup+ are not included. For example: n10Base col 132;Red;%smsupa=10;Blue;Green;Yellow n01Other primary;c=c132’5/&’;smsup+ col 133;Pale blue;Mauve;Grey;%smsupa=10
Here, the Other element will include all answers coded as 132’5/&’ and also the count for red if it is less than 10. It will not include the count for grey, even if that element is suppressed. To create an element which is solely a count of suppressed elements, write a statement of the form: n01Suppressed elements;dummy;smsup+
If you’re using smsup+ in a table of nets, and you want the suppressed elements to be accumulated into other elements at the correct net level, include netsm on the a, sectbeg, flt, tab or l statement.
☞ For further information about suppressing small values with nets, see ‘Accumulation of suppressed elements by net level’ in chapter 3, ‘Introduction to axes’. sortcol
Determines the column on which the table should be sorted.
subsort
Denotes the start of a subgroup to be sorted internally within a sorted table.
☞ For further information about sorting, see section 6.3, ‘Sorting tables’ in the Quantum User’s Guide Volume 3. summary
For ex= elements on n01 statements, summary indicates that the raw counts, and not the calculation results, are to be used to decide whether rows or columns are to be suppressed in a secure Quanvert database.
☞ For further information, see section 7.11, ‘Secure databases’ in the Quantum User’s Guide Volume 4. supp
Suppresses percentages for a single row when percentages have been requested for the rest of the table.
toptext=
Defines a text to be used as a column heading when the element text is unsuitable for this purpose, for example, because it is too long. For example: n23Visited Museum Before;toptext=Been Before
118 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
tstat
Include this element in the special T statistics. This is the default for n01, n15 and their equivalents on col, val, bit and fld statements.
unln
Underlines the element text. The amount of underlining is determined by the value of n: 1 2 3
underline the whole text underline the whole text, excluding strings of blanks underline words only. Blanks of any kind are ignored
Data options Data options determine how the counts in the table will be calculated. These options are not concerned with the way the axis is laid out. c=logical_expression Defines the conditions for an element. c= is only valid on n statements.
☞ For further information about c=, see section 3.3, ‘Defining conditions for an element’. effbase
Print an effective base element in a weighted table.
✎ effbase affects the processing of special c=– conditions. If you want to print an effective base without affecting the processing of these special statements, use an n31 statement and not effbase.
☞ For further information about the n31 statement, see section 5.8, ‘Printing the effective base’ in this volume. For further information about the effective base, see section 7.3, ‘T statistics on weighted tables’ in the Quantum User’s Guide Volume 3. ex=expression Alters the figures in the row using row manipulation techniques.
☞ These are described in section 2.2, ‘Manipulation on N-statements’ in the Quantum User’s Guide Volume 3. fac=n
Defines a factor to be used in statistical calculations. It is generally required when the data is multicoded or the codes in the data are not the values to be used for the calculation of means, standard errors and suchlike.
More about axes – Chapter 4 / 119
Quantum User’s Guide Volume 2
Factors (n) may be real or integer. Normally, you will be told when factors are required. A typical example might be a question asking respondents to rate a product on a scale of 1 to 5, where 1 is excellent and 5 is very poor. The responses will appear in the data as 1 to 5, but the factors for the calculation of a mean score may be +2 (excellent) to −2 (very poor). Assigning a factor of zero is not the same as assigning no factor at all. A factor of zero causes all cells in that row or column to be multiplied or divided by zero when they are included in statistical calculations, whereas no factor at all causes them to be ignored completely by the statistical statements. Here’s an example of an axis using fac=: n10Base n23Rating for Brown’s Baked Beans n01Excellent;c=c127’1’;fac=2 n01Good;c=c127’2’;fac=1 n01Acceptable;c=c127’3’;fac=0 n01Poor;c=c127’4’;fac=–1 n01Very poor;c=c127’5’;fac=–2 n01DK/NA;c=–
When used on a col or val statement, fac= becomes more flexible. If the factor is to be incremented or decremented progressively by a constant for each row of the axis, you may enter the factor for the first row and follow it with the amount by which it is to be incremented or decremented when applied to all subsequent rows. The example used above could be rewritten: col 127;Base;Excellent;%fac=2-1;Good;Acceptable;Poor; +Very poor;DK/NA;%nofac
This still assigns a factor of 2 to Excellent, 1 to Good, and so on down to a factor of −2 for Very poor. The option nofac attached to ‘DK/NA’ indicates that this element should have no factor at all, thus it will be ignored by all statistical statements. It is the same as omitting fac= from an n01 statement.
✎ The factor does not alter the figures in the row itself: if you want to define a scaling factor to increase or decrease the figures in the row by a given amount, use the option scale= which is described below.
☞ For further examples of fac=, see chapter 5, ‘Statistical functions and totals’. inc=arithmetic_expression In most tables, cells are counts of people because each cell is incremented by 1.0 for each respondent included in that cell. Cells may also be incremented by the value of an arithmetic expression; for instance, we may wish to know how many boxes of dog biscuits a respondent bought, or the number of children there are in a household. 120 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
In both cases we would produce the table using the appropriate axes for row and column definitions, but instead of incrementing the cells by 1 for each respondent, we would increment it by the number of boxes of dog biscuits he or she bought or the number of children in his or her household. (This presupposes, of course, that this information is available somewhere in the data file). To increment cells by the value of an arithmetic expression rather than by 1, we use the option inc=arithmetic_expression. Let’s work through an example. Suppose we have a question asking how many times the respondent visits various shops in a week. The information is stored in the following columns: c(109,110) = Safeway c(111,112) = Sainsbury c(113,114) = International c(115,116) = Tesco We need to create a table showing the total number of times each shop is visited. This entails incrementing each cell in a given row by the number in the relevant columns, for instance, if row 1 refers to Safeway, cells in that row need to be incremented by the value in c(109,110). What we do is set up an axis in which each row refers to a different shop, and use inc= to define the columns whose values are to be added into the cell: l shop n04Total Visits;base n01Safeway;inc=c(109,110) n01Sainsbury;inc=c(111,112) n01International;inc=c(113,114) n01Tesco;inc=c(115,116)
In this example, we are using an n04 statement to produce a count of the total number of visits made. We have also used the keyword base on this statement to use it as a base for percentaging. If we cross-tabulate this axis against the axis region, it might look something like Figure 4.3.
☞ For further information about n04s, see chapter 5, ‘Statistical functions and totals’.
More about axes – Chapter 4 / 121
Quantum User’s Guide Volume 2
Base Total Visits Shops Visited Safeway Sainsbury International Tesco
Area of Residence Area 1 Area 2
2109 635 30% 424 20% 630 30% 420 20%
Area 3
413
882
814
143 35% 95 23% 105 25% 70 17%
257 29% 172 20% 272 31% 181 20%
235 29% 157 19% 253 31% 169 21%
Figure 4.3 Table using inc= If the variable used with inc= is non-numeric, or the value of the arithmetic expression is based on non-numeric data, it is ignored if missing values processing is switched on for the tabulation section. Using the shop axis shown earlier, this is the equivalent of writing statements of the form: n01Safeway;inc=c(109,110); +c=c(109,110).gt.0 .or. c(109,110)=$00$
However, if missing values processing is not in force, you need to include a condition in order to exclude any blank or non-numeric data. For example: n01Safeway;inc=c(109,110); +c=c(109,110).in.(1:99)
Where inc= has been used at a higher level (for example, on the tab statement as well as on the element), the increment may be switched off for a single element with the option noinc on the appropriate element. Where inc= is present at several levels, the rules are as follows: Position of inc=
Rule
On tab and l
Both increments are applied
On tab and element
inc= on the element overrides inc= on the tab for that element only
On l and element
inc= on the element overrides inc= on the l statement for that element only
On tab, l and element
inc= on the element overrides inc= on the l statement for that element only; inc= on the tab is multiplicative with the l or element inc= as appropriate
122 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
For example: tab ax01 ban01;inc=c10 l ax01;inc=c11 col 29;first;second;third;%inc=c12
The first and second elements are incremented by the values in c10 and c11; the third element is incremented by the values in c10 and c12.
✎ inc= may also be used on elements when tables of means, medians, maximum or minimum values are required.
☞ For examples of a table of means and a table of minimum/maximum values of incs, see section 2.5, ‘Sample tables’. inctext=description_text Can be used with the inc= option to specify a description text for a numeric variable. When a numeric variable appears many times in the program, Quantum only uses the first inctext= associated with the variable. However Quantum issues a warning on the screen and in out1 if the text on subsequent inctext= statements differs from that on the first statement. This test is case-sensitive, so Quantum issues a warning if the first text is ‘Serial number’ and the second is ‘serial number’. If no inctext= is specified for an inc=, Quantum generates a description text that matches the specified name. If inctext= is specified on a statement with no inc=, it is ignored with a warning message. inctext= is not valid for elements of grid axes, nor for pre= or post= options on wm statements.
✎ You define numeric variables for use in Quanvert databases and for export to SPSS or SAS with the namedinc statement.
☞ For information about using namedinc for exports to
SPSS or SAS, see chapter 4, ‘Data conversion programs’ in the Quantum User’s Guide Volume 4. For information about using namedinc when setting up a Quanvert database, see chapter 5, ‘Preparing a study for Quanvert’ in the Quantum User’s Guide Volume 4.
keep[=type]
Tags an element for use in a percentage difference calculation.
☞ For further information, see section 4.9, ‘Percentage differences’.
More about axes – Chapter 4 / 123
Quantum User’s Guide Volume 2
levbase
Increments the base element of an uplev’d axis for all records at the anlev level.
☞ For further information, see ‘uplev and levbase’ in chapter 3, ‘Dealing with hierarchical data’ in the Quantum User’s Guide Volume 3. maxim
Used with inc= to produce an element that shows the maximum value of the inc= variable. Zero values are ignored.
median
Used with inc= to produce an element that shows the median value of the inc= variable. Zero values are ignored.
minim
Used with inc= to produce an element that shows the maximum value of the inc= variable. Zero values are ignored.
missing=expression Treats values defined by the logical expression the same as missing values if missing values processing is switched on for the tabulation section. This option is valid anywhere that inc= is valid, but you will usually use it on definitions for statistical elements such as n25s or on n01s that create medians. For example: n01Median value;inc=c(123,127);median; +missing=c(123,127).le.0
This calculates a median value by summing up the values in columns 123 to 127. Values that are less than or equal to zero are treated as missing values and are excluded from the calculation if missing values processing is switched on for the tabulation section. missingval
Exports non-numeric data as missing_. This facility is always available regardless of whether missing values processing is on or off. When you use Quantum to export data for use with SAS or SPSS, Quantum codes the data according to the position that the element occupies in the axis. For example, in the axis: l sex col 110;Base;Male;Female n01Not answered;c=-
Men are coded as 1, women as 2 and anyone who did not answer is coded as 3. If you want the data to be exported so that respondents in the Not answered element has the value missing_, add the option missingval to the element. For example: n01Not answered;c=-;missingval
noround
Prevents the cell count for this element being altered when rows or columns are rounded to 100%.
op=A/B
Selects an element for use in a percentage difference calculation.
124 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
☞ For further information, see section 4.9, ‘Percentage differences’. rej=n
This is used to exclude records belonging in one row from one or more other rows. The rows from which records are excluded have the option rej=0, and the row which is to be excluded has the option rej=1. For example: l ax01 n10Base;rej=0 col 238;Brand A;Brand B;BrandC; n01DK/NA;c=c238n’1/3’;rej=1
Here, any respondent in the category ‘DK/NA’ will be excluded from the base row; that is, anyone who does not have a 1, 2 or 3 in column 238.
✎ Only one element in an axis may have rej=1 on it. wm=n
Weights the element using weights in weight matrix n.
☞ For further information, see section 1.8, ‘Using weights’ in the Quantum User’s Guide Volume 3.
4.9 Percentage differences Quick Reference To calculate the difference between two percentages, type: keep[=pc_type] on one of the elements to be used in the calculation. The default is to use unrounded figures in the calculation; to use rounded figures, enter pc_type as print. Then identify the second percentage with either: op=A to subtract the keep= percentage from this element, or: op=B to subtract the percentage for this element from the keep= percentage.
More about axes – Chapter 4 / 125
Quantum User’s Guide Volume 2
Quantum can calculate the difference between two percentages. The difference is simply the result of subtracting one percentage value from the other; for example, 25%−15%=10%. There are three options: keep[=pctype] Marks the element or table defining the type of percentage to be used in the difference calculation (that is, row, column, total, and so on). pctype is a keyword which defines whether the calculation should use the unrounded percentages which Quantum stores internally, or the rounded ones which are printed in the table. The default is keep=value which uses the unrounded figures; use keep=print to use the rounded ones. op=B
Subtract the percentage for this element or table from the keep percentage.
op=A
Subtract the keep percentage from the percentage for this element or table.
For example, the axis segment: n11Base n01Brand A: January;c=c115’1’;keep;op=12 n01Brand A: February;c=c115’2’;op=12 n01Increase(+) / Decrease(-) Jan to Feb;c=c115’2’;op=A
calculates the difference between the percentages for January and February by subtracting the January percentage from the current percentage. For example: Brand A: January Brand A: February Increase(+) / Decrease(-) Jan to Feb
Base 100 50% 150 75% 25%
In this example, we have created a separate element for the percentage difference. If you prefer, you can create an axis in which all elements except the first one contain percentage differences. If we rewrite our example as: n11Base n10Brand A: January;c=c115’;keep;op=12 n10Increase/Decrease to February;c=c115’2’;op=A
126 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
Our table becomes:
Brand A: January Increase/Decrease to February
Base 100 50% 25%
If we wanted to see the actual figures for February as well, we would write the op=A element as: n01Increase/Decrease to February;c=c115’2’;op=12A
which would produce the table:
Brand A: January Increase/Decrease to February
Base 100 50% 150 75% 25%
The order of options with op= is important with this facility if you are to get the figures you expect. When Quantum encounters a keep element, it looks at the options for that element (or the defaults for that table or run if none are defined) and keeps the ‘last’ one. In this instance, ‘last’ means last in the order: 1 2 6 0 & 8 3
Absolutes Column % on current base Column % on first base Row percentage Total percentage Indices Row ranks
So with op=120, keep will store the row percentage for calculation purposes. In the examples above, the options were always op=12, so all calculations were based on column percentages. If a cell in the op=A/B element does not have the percentages required by the keep element, it will use whatever figures are available in the op=A/B element, even if these happen to be absolute figures rather than percentages. This might happen if the op=A/B element has a row percentage flag (for example, op=10A), but the table or run does not have the option acr100 for percentages on the base column. Where a table contains keep and op=A/B options in more than one axis, the keep/op= in the column axis overrides that in the row axis, which in turn overrides that in the third dimension axis. Keep/op= in higher dimensions are ignored.
More about axes – Chapter 4 / 127
Quantum User’s Guide Volume 2
Keep and op=A/B may not appear on the same element. Therefore, if you want a table of rolling differences (that is, the difference between the current element and the previous element), you need to create a separate element for each percentage difference element, which may or may not be printed in the table. Here are two variations of such an axis: n01January;c=c115’1’ n01February;c=c115’2’;keep n01% change Jan to Feb;c=c115’1’;op=B n01March;c=c115’3’;keep n01% change Feb to Mar;c=c115’2’;op=B n01April;c=c115’4’;keep n01%change Mar to Apr;c=c115’3’;op=B
In this example, notice that the % change element refers to the previous rather than the current month, so that the difference is always calculated by subtracting the current month from the previous month. This might produce the table: January February % change Jan to Feb March % change Feb to Mar April % change Mar to Apr
25% 28% 3% 26% -2% 22% -4%
To create the same table so that only percentage difference elements are shown for each month, the axis may be written with suppressed elements, thus: n01January;c=c115’1’;keep;op=2 n01Change January to February;c=c115’2’;op=2A n15;c=c115’2’;keep;op=2 n01Change February to March;c=c115’3’;op=2A n15;c=c115’3’;keep;op=2 n01Change March to April;c=c115’4’;op=2A
The table produced is as follows: January Change January to February Change February to March Change March to April
25% 3% -2% -4%
✎ n15 statements only work with keep when the axis is used for the rows of a table.
128 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
Our examples so far have all referred to elements in axes, but keep and op=A/B are also valid on tab statements to generate tables in which the cell values are the differences between corresponding cells in two tables. Generally, you’ll use this facility when the two tables refer to different sections of the population. For example: tab prefer region;keep tab prefer region;c=c123’4’;op=B
The first table is the whole population and the second table is, say, everyone who works full-time. Quantum does not print this second table as such. Instead, it creates it in memory but then subtracts the figures for that table from those in the kept table and prints the results as the second table. Thus, if the population base for the eastern region is 17% and the base of full-time workers for the same region is 10%, the figure in the final table will be 7%.
✎ Percentage signs are printed according to the requirements for the table as a whole. op=A and op=B are mutually exclusive: they cannot be present together.
4.10 Distributing records from one element across the axis Quick Reference To define an element whose counts are to be distributed among the other elements in the axis, type: ndi[;element_text] [;condition] [;options] Quantum allows you distribute records belonging in one chosen element between the other elements in the axis. One example might be a No Answer element in a brand list axis, where those respondents who gave no answer are distributed amongst the brand elements of the axis. To define an element of this type, enter the statement: ndi [;text] [;condition] [;options] where condition is a standard condition defining the respondents who are to be distributed across the other elements in the axis, and options are any of the options accepted on n statements. ndi elements are normally suppressed when the axis is used as the rows or columns of a table, and are always ignored when the axis is a higher dimension. Use the options row and/or col to override this suppression with row and/or column axes.
More about axes – Chapter 4 / 129
Quantum User’s Guide Volume 2
Records belonging in an ndi element are distributed proportionally across all totalizable elements between the most recent base or ndi statement, whichever is the latest, and the ndi statement being processed. All totalizable elements are eligible to receive distributed values regardless of whether or not they are printed. (Totalizable elements are elements such as n01 and its equivalents which may be added up to form a total. Statistical and base elements are not totalizable because they are excluded from totals). If you want to prevent an element from receiving distributed values, include the keyword ntot in its definition. This flags it as a non-totalizable element which Quantum ignores for distribution purposes. The formula used in the distribution process is: Nx cell = count * 1.0 + ------------- Nj
∑
where: count
is the number of cases in the current cell.
Nx
is the number of cases in the ndi element.
∑ Nj
is the sum of cases in the totalizable elements.
✎ The formula uses the sum of the values in the totalizable elements and not the base because some records may be present in the base but not in any other elements of the axis and some of the elements may be multicoded.
Compare the two tables below. The first is a standard table with no ndi element; the second is a variation of this in which the No Answer element has been defined with an ndi statement instead of an n01. The 5 respondents in this element have been distributed proportionally amongst the other elements according to the number of records in those elements. Hence, the increase from 15 to 16 male respondents for Brand A is the result of the calculation (15*(1+5/95)).
130 / More about axes – Chapter 4
Quantum User’s Guide Volume 2
Base Brand A Brand B Brand C Brand D No Answer
Base 100 31 35 19 10 5
Male 46 15 17 9 3 2
Female 54 16 18 10 7 3
Base Brand Brand Brand Brand
Base 100 33 37 20 10
Male 46 16 18 9 3
Female 54 17 19 11 7
A B C D
In this example, the base is the sum of the totalizable elements, but this is not always the case. The specifications which created these two tables are as follows: tab brdna sex tab brand sex l sex col 110;Base;Male;Female l brdna col 156;Base;Brand A;Brand B;Brand C;Brand D;No Answer=’ ’ l brand col 156;Base;Brand A;Brand B;Brand C;Brand D ndi;c=c156’ ’
More about axes – Chapter 4 / 131
5 Statistical functions and totals Part of Quantum’s power lies in the fact that it offers you the ability to create various types of statistical output without having to know the formulae necessary to calculate them. This chapter describes these statements and provides examples of how to use them. It also discusses the statements available for creating totals and sub-totals within a table.
☞ For information about other less frequently-used statistics, see chapter 4, ‘Descriptive statistics’, chapter 5, ‘Z, T and F tests’ and chapter 7, ‘Special T statistics’ in the Quantum User’s Guide Volume 3.
5.1 Creating totals Quick Reference To create a total, type: n04[element_text] To create a subtotal, type: n05[element_text]
Totals in Quantum are sums of all rows or columns created by n01, n15, col, val, bit or fld statements. Statements which generate totals are n04 and n05. Regardless of its position in the axis, the n04 sums all counts from the beginning of the table up to the end of the table, or until another base-creating element is read in the axis, whichever comes first. Therefore you need not put the n04 at the end of the axis if that is not where you want it to go. For instance, col 257;Base;First Row;Second Row;Third Row n04Total
produces exactly the same total as: n10Base n04Total col 257;First Row;Second Row;Third Row
Statistical functions and totals – Chapter 5 / 133
Quantum User’s Guide Volume 2
If the n04 is placed between the top of the table and a base, it provides a total of all counts between the top of the table and that base. Likewise, if it occurs between a base and the bottom of the table, the total is the sum of all counts between the base and the end of the table. If it is between two bases, the n04 totals all counts between the two base rows. If one of the other rows is a subtotal (n05), the n04 will ignore the figures in that row. There is one thing to beware of. Some tables will include net rows which are counts of respondents included in the previous or following groups of rows. If the net is created using an n01;c=+ statement, the total calculated by the n04 will include not only the individual rows but also the nets of those rows. The n04 is a sum total of counts, just as if you had typed the figures from each row into a calculator. If you want to produce a total which excludes nets you will need to replace the n04 with an n01 containing an appropriate condition, or create the net using a net statement. Here is a simple example to illustrate this: l try1 n10Base col 153;Base;hd=Overall Rating;Excellent;Very Good n01Excellent/Very Good (Net);c=+2 col 153;Good=’3’;Fair=’4’;Poor=’5’;DK/Refused=’&’ n04Total
The total for this axis will be the sum of the two rows created by the first col statement, plus the n01 row, plus the four rows on the second col statement. To exclude the net row from the total, replace the n04 by an n01, as follows: l try1 n10Base col 153;Base;hd=Overall Rating;Excellent;Very Good n01Excellent/Very Good (Net);c=+2 col 153;Good=’3’;Fair=’4’;Poor=’5’;DK/Refused=’&’ n01Total;c=+
The condition c=+ says that anyone who has been included in any of the previous rows should be included in this total row. Each person is counted once only, regardless of the number of rows he or she appears in. The n05 creates subtotals starting from the beginning of the table, or the most recent base, or the most recent n05, whichever comes last, and ending with the element immediately before the n05 itself, as illustrated in Figure 19.1.
✎ Neither the n04 nor the n05 is affected by n00 statements.
134 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
The specification for the table shown in Figure 5.1 is: /* Bread buyers have C125’1’ /* Number of loaves bought is in C(132,133) tab ax04 loaf;c=c125’1’ ttlBase : Respondents Who Bought Bread l loaf;inc=c(132,133) n10Base;noinc val c(132,133);hd=Number of Loaves Purchased Last Month +i;1-5;6-10;11-20;21-30;31+ l ax04 n10Base n23Bought from Supermarket col 130;White;Wholemeal n05Subtotal n03 n03Bought from Baker’s col 130;White;Wholemeal n05Subtotal n03 n04TOTAL
Base: Respondents Who Bought Bread Number of Loaves Purchased Last Month Base 1-5 6-10 11-20 21-30 31+ --------------------------------------------Base 1105 121 Bought from Supermarket White 1436 42 Wholemeal 1552 52 Subtotal 2988 94
319
285
204
129
196 123 319
429 453 882
392 422 814
377 502 879
Bought from Baker’s White 1934 Wholemeal 1504 Subtotal 3438
388 272 660
233 287 520
294 271 565
469 329 798
550 345 895
TOTAL
754
839
1447
1612
1774
6426
Figure 5.1 Totals and subtotals
Statistical functions and totals – Chapter 5 / 135
Quantum User’s Guide Volume 2
If you are new to Quantum, you may be glad of a little more explanation about this table. As we mentioned at the beginning of this manual, comments may be included anywhere in a Quantum program as long as they start with a slash and an asterisk (/*) in columns 1 and 2. We have used comments to remind us what the conditions on the tab and n00 statements mean. The table base is the number of people buying bread, and the rest of the table shows the number of loaves purchased by those people. The cell with the conditions ‘White’ and ‘11-20’ under the subheading ‘Bought from Supermarket’ tells us that 429 loaves were bought by people who bought white bread in a supermarket and who bought between 11 and 20 loaves of bread last month. The cell is a count of loaves bought rather than of people buying bread because of the inc= on the l statement. This says, whenever a respondent satisfies the condition for a cell, increment that cell by the value in c(132,133) rather than by 1. Without the inc=, this cell would tell us how many people who bought 11 to 20 loaves last month bought white bread in a supermarket.
5.2 Statistical statements Statements which perform statistical calculations are: n07 n12 n13 n17 n19 n20 n30 n31
average mean sum of factors standard deviation standard error of the mean error variance of the mean medians and percentiles effective base
In most cases, all you need to do is enter the statement at the point at which it is to be printed. All statements are formatted in the same way, namely: naa[text];[options] where aa is the n statement number. The only options valid on all statistical statements are dec=, id= and scale=. The n30 also needs a fac= to define the factors for each range of values. If the table contains absolute and percentage figures, the percentages are suppressed for the rows or columns created by these elements.
136 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
✎ For means and other statistics (such as standard deviations), Quantum differentiates figures in which the sum of values is zero, and those in which the sum of cases (that is, respondents) is zero. If the run or table uses the option spechar to print special characters in place of zeros, Quantum only prints the special character if the number of cases going into the mean is zero. So 0/3 is always printed as zero, whereas 0/0 is printed as the special character for zero if one has been defined.
5.3 Averages Quick Reference To create an element whose value is the average of the values in the other elements of the axis, type: n07[element_text] To exclude zero cells from being counted when calculating the average, type: n07[element_text];ignorezeros
In Quantum, the average (n07) is calculated by summing up the cell counts generated by n01, col, val, bit and fld statements, and dividing the result by the number of elements summed. Only rows before the n07 are included. If the axis contains more than one n07, the second average deals only with those rows between it and the previous n07. If we had placed an n07 at the end of the row axis in Figure 19.1, the average for the base column would be: (1436 + 1552 + 1934 + 1504) / 4 = 1606 By default, Quantum always divides the sum of values by the total number of elements, including cells that are zero. To exclude zero cells from being counted, type: n07[element_text];ignorezeros So, if we are calculating the average of four elements whose counts are 10, 20, 0, 10, by default Quantum sums these counts and divides by four. The average of this calculation is 10. However, using ignorezeros excludes the third element from the calculation and gives the average as 13.33. You can specify noignorezeros to revert to the default.
✎ You can only use ignorezeros on an n07 statement; it is not valid on any other statements.
Statistical functions and totals – Chapter 5 / 137
Quantum User’s Guide Volume 2
Do not confuse the average with the mean. The average is based on counts in the table, and the rows containing those counts; the mean is based on values in the data (or factors associated with those values), and respondents.
☞ For further information on means, see the next section. The mean figure for the base in Figure 5.1 is: (1436 + 1552 + 1934 + 1504) / 1105 = 5.81 The cell counts are the same as for the average because they are read directly from the data with inc=, but instead of dividing by the number of elements we divide by the number of respondents giving those answers.
✎ Be careful if you use averages in axes with nets: the net figures will be included in the average which is probably not what you want.
5.4 The mean, standard deviation, standard error and error variance Quick Reference To create an element whose value is the mean of the values in the other elements of the axis, type: n12[element_text] To create a standard deviation element, type: n17[element_text] To create a standard error element, type: n19[element_text] To create an error variance element, type: n20[element_text]
All rows that are to be included in these calculations need factors. These may be defined using fac= on each row or by the option inc= on an n25 statement. If the latter, the n25 must come before the statistical statement.
138 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
When an axis contains both fac= and n25;inc=, and statistics are requested, Quantum must decide which values to use in the statistical calculations. To do this, it works backwards from the statistical element to the start of the axis looking for elements with fac= or an n25 statement. If it finds an n25 first (that is, latest in the axis), it uses the values named with inc=. If the first thing found is a group of elements with fac=, then the statistics are based on those factors. If neither is found, Quantum issues an error message to that effect. The mean (n12) reports the mean value of the factors or values belonging to each respondent.
✎ Because of the rounding involved in calculating means, it is important that you specify the number of decimal places that will provide the level of accuracy that you require.
The standard deviation (n17) tells you the amount by which you would expect respondents’ answers to differ from the mean. You can apply the standard deviation to the mean at three levels. If you just take the standard deviation reported by Quantum, you would expect 67% of answers to lie within the range mean±std.dev. You may also expect that 95% of answers lie within the range mean±2std.dev, and that 99% of answers will lie within the range mean±3std.dev. You use the standard error (n19) to estimate the mean for the population as a whole, based on the mean of your sample. You can be 95% certain that the mean score for the population as a whole will lie within the range mean±2std.err. The sample variance (also known as the error variance) is the square of the standard error.
5.5 The n25 statement Quick Reference To define incremental values for means, standard deviations, standard errors and error variances, type: n25[element_text; inc=arith_expr [;c=log_expr] [; row] [; col] The n25 does not normally print anything in the table. Use row and/or col to print these values as the rows and/or columns of the table.
Statistical functions and totals – Chapter 5 / 139
Quantum User’s Guide Volume 2
The n25 does not normally print out any rows in the table, but it creates three rows which are used by Quantum as part of the other statistical work. They are the sum of x2, the sum of x and the sum of n, and they are always in that order. To clarify this, here are examples of Quantum statements which you could write to produce the same figures. Throughout the examples we have used arbitrary columns and codes. The sum of n is the number of people in the table, which Quantum calculates as: n01Number of people;c=c115’2’ The sum of x is the sum of the multipliers (defined using fac= or inc=): n01sum of mult;inc=c(122,125);c=c115’2’ The sum of x2 is the sum of the squared multipliers: n01sum of sqmlt;inc=c(122,125) * c(122,125);c=c115’2’ If you want to print these figures in your table, add the options row and/or col to the n25 statement. If the axis is used to create the rows of a table, and row appears on the n25, three rows will be printed labeled text.1, text.2 and text.3 for the sum-of-x2, the sum-of-x, the sum-of-n respectively. Text is the element text defined on the n25. The same applies when the axis is used as a column axis and the n25 contains the option col, except that three columns are produced, rather than rows.
Using factors As we said in ‘Data options’ in chapter 4, ‘More about axes’, fac= defines factors when the numbers in the data are not to be used (for example, the data may be multicoded) whereas inc=, mentioned in the same section, reads the data from the column and uses that as the factor for each row. What to use and when is best illustrated by examples, although in general you should try to use fac= whenever possible since, in processing terms, it is more efficient than inc=. The respondents have been asked to say how much they agree or disagree with a particular statement. If they agree very much, they have a code ‘1’ in c210. If they agree somewhat, they have a ‘2’; if they neither agree nor disagree, they have a ‘3’; if they disagree somewhat, they have a ‘4’; and if they disagree very much, they have a ‘5’. People who refuse to answer are coded as c210’&’. We wish to obtain a numerical mean value of these opinions using factors of +2 for ‘agrees very much’ down to –2 for ‘disagrees very much’. These are not the same as the codes representing these responses in the data, so we enter them with fac=. People who refused to answer will appear in the table but will not be included in the mean.
140 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
We can write this axis using n01s or a col statement, both are equally correct: l vers1 n01Agrees Very Much;c=c210’1’;fac=2 n01Agrees Somewhat;c=c210’2’;fac=1 n01Neither Agrees Nor Disagrees;c=c210’3’;fac=0 n01Disagrees Somewhat;c=c210’4’;fac=-1 n01Disagrees Very Much;c=c210’5’;fac=-2 n01Refused;c=c210’&’ n12Mean;dec=2 l vers2 col 210;Agrees Very Much;%fac=2-1;Agrees Somewhat; +Neither Agrees Nor Disagrees;Disagrees Somewhat; +Disagrees Very Much;Refused=’&’;%nofac n12Mean;dec=2
In the second example, we have used the nofac option on the Refused element because we have used fac=2-1 to specify automatic factoring. If we had specified the factor separately for each element, the nofac option would not be necessary. The mean is the mean of the factors, calculated as: Mean = [(2 × number with c210’1’)+(1 × number with c210’2’)+...] / n where n is the number of respondents having an opinion — c210’1/5’. If there were 25 people who agreed very much, 19 who agreed somewhat, 7 who neither agreed nor disagreed, 15 who disagreed somewhat, 3 who disagreed very much, and 6 who refused to answer, the calculation would be: Mean = [(2×25)+(1×19)+(0×7)+(−1×15)+(−2×3)] / 69 yielding a mean value of 0.70. Notice that the 6 people who refused to answer were ignored completely.
Statistical functions and totals – Chapter 5 / 141
Quantum User’s Guide Volume 2
Using n25;inc= Now suppose that instead of using factors of +2 to −2 we are asked to use factors of 5 to 1, where 5 indicates that the respondent agrees very much and 1 means that he or she disagreed very much. Since these match the way the responses have been coded, we can use an n25 with an inc= to define the factors: l vers3 col 210;Agrees Very Much=5;Agrees Somewhat=4; +Neither Agrees Nor Disagrees=3;Disagrees Somewhat=2; +Disagrees Very Much=1;Refused=’&’ n25;inc=c210;c=c210’1/5’ n12Mean;dec=2
This time we exclude respondents refusing to answer by adding a condition on the n25, indicating that it refers only to those respondents having a 1, 2, 3, 4 or 5 code in c210. If we keep the same number of respondents in each group as before, the mean will be 2.30 as shown below: Mean = [(5×25)+(4×19)+(3×7)+(2×15)+(1×3)] / 69 When you have missing values processing switched on in the tab section, Quantum automatically excludes records with the value missing_ from the inc= element. In the axis: l rental val c(156,157);Base;i;None=0;1-5;6-10;11-15;16-20;21-30;31+ n01DK/NA;c=n25;inc=c(156,157) n12Mean number of videos rented by all who rent videos;dec=2
the n25 statement will include any respondent for whom c(156,157) contain a numeric value. Respondents for whom the field is non-numeric or totally blank will be excluded. If you want to create the same axis without using missing values processing, you can write: n25;inc=c(156,157);c=c(156,157).in.(1:99,$00$)
✎ If you want other values to be treated the same as missing values, add the option missing=logical_expression to the n25 statement.
☞ For further information, see the description of inc= in ‘Data options’ in chapter 4, ‘More about axes’.
142 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
Weighted runs Quick Reference Quantum normally calculates the standard error and the error variance using the unweighted count of respondents. If you would prefer to use the effective base in the calculation, place the keywords: nsw;useeffbase on the a statement.
In weighted runs, the standard error (n19) and error variance (n20) of the mean are calculated using an unweighted count of respondents (sum-of-n) rather than the weighted count of respondents. This unweighted value is calculated automatically and is stored as an n15 element with the option nontot to prevent it being included in totals created by n04 or n05 elements. If you would prefer to calculate the standard error and error variance using weighted figures, place the keywords useeffbase and nsw on the a statement. This tells Quantum to use the effective base rather than the unweighted count of respondents. The effective base is a value that is based on weighted totals but takes into account the possibility that the weighting may have drastically altered the proportion of one group of respondents relative to another. It is calculated as: EB = (sum of weights)2 / sum of squared weights An axis may contain more than one block of factors and associated statistics: each block will be dealt with independently.
✎ In weighted runs, standard deviations, standard errors and error variances are always zero when the weighted base is less than 1.0.
☞ For further information on the n15 statement, see ‘The n15 statement’ in chapter 3, ‘Introduction to axes’ in this volume. For details of the formulae for the mean, standard deviation, the standard error of the mean and the error variance of the mean, see section 5.9, ‘Formulae’ later in this chapter. For further information about the effective base and the nsw option, see section 7.3, ‘T statistics on weighted tables’ in the Quantum User’s Guide Volume 3.
Statistical functions and totals – Chapter 5 / 143
Quantum User’s Guide Volume 2
5.6 The sum of factors Quick Reference To create an element whose value is the sum of the factors used in the other elements of the table, type: n13[element_text]
The sum of factors created by an n13 is similar to the mean (n12) except that there is no division by the number of respondents. The calculation merely involves taking each row and multiplying the number of respondents in that row by the factor defined by fac= or inc=, and then adding these results together to get the sum of factors for all respondents. In the examples used for means, the sum of factors where factors of +2 to –2 were used is 48, but the sum of factors when they are 5 to 1 is 255.
5.7 Creating percentiles and medians Quick Reference To create a percentile element using factors, type: n30[element_text];fac=factor[;dec=dec_places] where factor is 50 for a median but may be any number between 1 and 100 depending on the calculation required. To create a percentile element using values from the data, type: n01[element_text];inc=variable;percentile=factor;c=log_expr where factor is 25 for a quartile but may be any number between 1 and 100 depending on the calculation required.
There are two ways of calculating percentiles: with factors (fac=) or with multipliers (inc=). Multipliers are more accurate and are used when the data contains the actual answer the respondent gave rather than a code representing a range of responses. Factors are used when responses have been coded into ranges. The difference between the two will become clear as we explain how to create them.
144 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
Percentiles from factors Percentiles with factors are created with an n30 formatted as follows: n30[Text]; fac=n[;dec=p] where: •
n is a number between 1 and 100 indicating the desired percentile level; for example, fac=50 for the median, fac=10 for the first decile, and so on.
•
p is the number of decimal places required. The default is dec=0.
The n30 must follow a set of n01/n15/col/val statements with factors defining the ‘weight’ to be used for each element. The normal practice is to set the factors to the highest point of each range. When the highest response caters for all values over a certain amount, you need to give careful consideration to the value you give its factor. The statements must be arranged so that the factors are listed in ascending sequence. Quantum uses the factors to create the percentile value. For example, suppose we have ranges of income coded into c281. We could set up our axis for medians and quartiles as follows: l income n10Base n23Household Income (in Pounds) n01No Income;c=c281’0’;fac=0 col 281;1-1000;%fac=1000+1000; +1001-2000;2000-3000;3001-4000;4001-5000;5001-6000; +6001-7000;7001-8000;8001-9000;9001-10000; +10001-10500=’–’;%fac=10500+500;10501+=’&’ n03 n30Lower Quartile;fac=25;dec=2 n30Median Income;fac=50;dec=2 n30Upper Quartile;fac=75;dec=2
The effort involved in writing out this axis has been minimized by using a col statement instead of n01s. However, if you only wanted to show the statistics (that is, the three n30 rows) you would have to suppress the other rows either by writing each one separately on an n15, or by using the option smsupa= on the rows to be suppressed. If the midpoint is in the range 6001-7000, Quantum will interpolate to produce a median value of, say, 6258.
✎ The requirements for setting factors for percentiles can sometimes result in the factors being unsuitable for creating means.
Statistical functions and totals – Chapter 5 / 145
Quantum User’s Guide Volume 2
How Quantum interpolates percentiles from factors When interpolating percentiles from factors, Quantum assumes that the value after the end of the previous range is the beginning of the next range and that the respondents in a range are evenly spaced within that range. This is illustrated by the following example. The factor assigned to each element is shown in brackets. Total
55
0 — 50 (fac=50)
9
51 — 100 fac=100)
4
101 — 200 (fac=200)
2
201 — 300 (fac=300)
13
301 — 400 (fac=400)
4
401 — 500 (fac=500)
4
Over 500 (fac=1000)
7
Refused/No answer Median
12 250
The base is 43, which is calculated by subtracting the 12 refusal and no answer responses from the total of 55. The median respondent is therefore the 21.5th person, who falls into the ‘201 – 300’ category. There are 13 respondents in this category, and Quantum assumes that they are evenly spread at intervals of 100 ÷ 13 = 7.69 . There are 15 respondents altogether in the previous three categories, so the 21.5th respondent is the 6.5th respondent in the ‘201 – 300’ category, and is at an interval of 6.5 × 7.69 = 50 from the end of the previous category, 200. So Quantum adds 50 to 200 to give a median of 250.
Factors in reverse order The n30 calculation for percentiles requires factors to be assigned to elements in ascending order. If you define factors in descending order, that is, from highest to lowest, Quantum will calculate a percentile but it will be incorrect when compared with the data. Here are two simple tables to illustrate this. The row axis for the first table is: l rating1 col 137;Base;Excellent (fac=1);%fac=1+1;Very Good (fac=2); +Good (fac=3);Fair (fac=4);Poor (fac=5) n12Mean;dec=2 n30Median;dec=2;fac=50
146 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
The row axis for the second table is: l rating2 col 137;Base;Excellent (fac=5);%fac=5-1;Very Good (fac=4); +Good (fac=3);Fair (fac=2);Poor (fac=1) n12Mean;dec=2 n30Median;dec=2;fac=50
The tables produced by these axes are as follows: rating 1 Base
rating 2 25
Base
25
Excellent (fac=1)
4
Excellent (fac=5)
4
Very Good (fac=2)
5
Very Good (fac=4)
5
Good (fac=3)
3
Good (fac=3)
3
Fair (fac=4)
4
Fair (fac=2)
4
Poor (fac=5)
9
Poor (fac=1)
9
Mean
3.36
Mean
2.64
Median
3.13
Median
2.88
There are 25 respondents in both tables, so the median respondent is the 12.5th respondent. The first table shows that the median was between Good and Fair. This is correct because the 12.5th respondent lies between Good and Fair. The second table also shows that the median rating was between Good and Fair. However this is wrong, because when the cases are sequenced in ascending factor order, the 12.5th respondent lies between Poor and Fair. To create a table that uses the reverse order factors and produces a correct median, define the axis in two sections. The first section defines the elements as they are to be printed and with the factors required to create the mean. The second section defines the factors for the median but because it is defined using n11 and n15 statements it does not create lines in the table. In this section the elements are defined in the opposite order (Poor to Excellent) so that the factors for the median appear in ascending sequential order.
Statistical functions and totals – Chapter 5 / 147
Quantum User’s Guide Volume 2
Here is the revised axis: l rating3 col 137;Base;Excellent (fac=5);%fac=5-1;Very Good (fac=4); +Good (fac=3);Fair (fac=2);Poor (fac=1) n12Mean;dec=2 n11 n15Poor;fac=1 n15Fair;fac=2 n15Good;fac=3 n15Very Good;fac=4 n15Excellent;fac=5 n30Median;dec=2;fac=50
The table that this axis produces is: Base
25
Excellent (fac=5)
4
Very Good (fac=4)
5
Good (fac=3)
3
Fair (fac=2)
4
Poor (fac=1)
9
Mean
2.64
Median
1.88
Troubleshooting Problems can arise when the median or percentile falls in the first or last element with a factor. For example, if you have a rating scale with factors of 1 for Excellent through to 6 for Very Poor, and all respondents rated the product as Excellent, Quantum might report a median value of 0.5, rather than a value of 1.0, which you might expect, as that is the rating everyone gave. The reason for this is that when Quantum looks at the first element in the rating scale, it finds that there is no previous element so it uses a factor of zero for the nonexistent element. The range for Excellent is therefore 0 to 1 and its median is 0.5. If you have a table of this type, and you want to see a percentile that matches the factor of the element in which all respondents are held, insert a dummy nonprinting n15 element above the first real element, and give it the same factor as the real element. In our example, if we insert a dummy element with a factor of 1 before the Excellent element, the median for all respondents in Excellent would be 1.0 (between 1 and 1).
148 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
Here is the axis: l rating n10Base n15;dummy;fac=1 col 143;Excellent;%fac=1+1;Very good;Good;Satisfactory; +Poor;Very poor n30Median;fac=50;dec=1
This use of a dummy element does not affect means, nor does it affect the percentile calculation if respondents are more evenly spread across the elements.
✎ In statistical terms, percentiles are only useful in data that is spread out across the full range of the scale, that is, where respondents are present in all elements. Calculations based on data that is clustered at either end of the scale may be misleading.
Percentiles based on numeric variables Quantum can calculate percentiles based on the results of numeric variables. An example is where the data contains the actual family income rather than a code representing a range of incomes. This allows you to obtain a more accurate figure by using inc= to read the values from the data. The format of percentiles with inc= is: n01Text ;inc=variable ;percentile=factor; c=condition For example: n01First Quarter;inc=c(123,127);percentile=25;c=c(123,127)u$
$
Notice that this calculation uses an n01 for both the elements and the percentile: it does not use an n30.
Statistical functions and totals – Chapter 5 / 149
Quantum User’s Guide Volume 2
An example of using percentile could be where you want to produce a table showing the actual family income, by region, along with the median and quartile figures. Thus, our example might read: tab totalincome sex l totalincome val c(123,127);Base;hd=Household Income (in Pounds);=; 0; i; +1-3000; 3001-6000; 6001-9000; 9001-12000; 12001-15000; 150001+ n03 n01Lower Quartile;inc=c(123,127);percentile=25;c=c(123,127)u$ $ n01Median Income;inc=c(123,127);percentile=50;c=c(123,127)u$ $ n01Upper Quartile;inc=c(123,127);percentile=75;c=c(123,127)u$ $ l sex col 110;Base;Male;Female
The table it produces is:
Base Household Income (in pounds) 0 1-3000 3001-6000 6001-9000 9001-12000 12001-15000 15001+ Lower Quartile Median Income Upper Quartile
Base 464
Male 232
Female 232
76 22 44 102 144 18 58
28 13 11 38 96 15 31
48 9 33 64 48 3 27
4951 8418 11077
7364 10002 11098
4451 6874 9591
✎ You can use the keyword median instead of percentile=50. If you are in doubt as to how to request percentiles on a table, follow the rules below: Data contains
Calculate percentiles with
Request percentiles with
Codes
Factors
fac= on elements and n30
Numeric values
Values from data
n01 and inc=
150 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
However when you are preparing a study for Windows-based Quanvert, always specify percentiles by using fac= on the elements and the n30 statement, because Windows-based Quanvert does not produce reliable figures for percentiles that have been specified using n01 statements with inc=. As with the other statistical statements, the percentile and median keywords suppress percentages for the row or column of percentile values. When Quantum calculates percentiles from numeric variables, it writes information to temporary files on the disk which it then reads later in the calculation. If you see error messages about Quantum being unable to locate or open files at this point it is possible that the disk is full and the file was not created. If this happens, try to make some extra space on the disk before rerunning your job. Alternatively, remove some of the percentile requests or split the job into two smaller ones.
Interpolation with percentiles When you calculate percentiles from numeric variables using inc=, Quantum provides four methods of interpolation for calculating the percentile values. You define the interpolation method to be used with the medint= option on the a, tab or flt statement. When no medint is specified, Quantum assumes the default of medint=0. The following table is used to illustrate the different types of interpolation. Base Base
20
Value is 1
5
Value is 2
6
Value is 3
3
Value is 4
3
Value is 5
3
Although the examples illustrate these options for calculating medians, the same principles apply to calculating any other percentile value. medint=0
Interpolate between the value exceeding the percentile mark and the previous value. This is the default interpolation method. Using this method of interpolation, the median for the example table is reported as 1.83, which is an interpolation between 1 and 2. The median respondent is the tenth respondent, who gave a response of 2. The value exceeding the median respondent is the response given by the 11th respondent, which is also 2, and the previous value is 1. Six people gave a response of 2 and Quantum assumes that they are evenly spaced between the two interpolation values of 1 and 2; that is, that they are spaced at intervals of 1 ÷ 6 = 0.16667 . The median respondent is the fifth respondent who answered 2. The median is therefore calculated as 5 × 0.16667 + 1 = 1.83 .
Statistical functions and totals – Chapter 5 / 151
Quantum User’s Guide Volume 2
medint=1
No interpolation. Quantum reports the exact value which exceeds the percentile mark. Using this method, the median in the example table is reported as 2.00 because this is the 11th value found.
medint=2
Interpolate between: •
the midpoint between the percentile mark and the previous value, and
•
the midpoint between the percentile mark and the next value
Using this method, the median in the example table is reported as 2.33, which is an interpolation between 1.5 and 2.5. The median respondent gave a response of 2, so the previous value is 1 and the midpoint between these two values is 1.5. The value after the median respondent’s value is 3, and the midpoint between this and the median respondent’s value of 2 is therefore 2.5. Quantum interpolates between the two midpoint values of 1.5 and 2.5. The difference between them is 1, and Quantum assumes that the six people who gave a response of 2 are evenly spaced at intervals of 1 ÷ 6 = 0.16667 . The median respondent is the fifth respondent who gave the response of 2, so the median is calculated as 5 × 0.16667 + 1.5 = 2.33 . medint=3
Interpolate between the percentile mark and the next value. The median for the sample table is 2.83 which is an interpolation between 2 and 3. Six people gave a response of 2 and Quantum assumes that they are evenly spaced between the two interpolation values of 2 and 3; that is, that they are spaced at intervals of 1 ÷ 6 = 0.16667 . The median respondent is the fifth respondent who answered 2. The median is therefore calculated as 5 × 0.16667 + 2 = 2.83 .
✎ The medint option has no affect on percentiles calculated from factors using an n30 statement. For these percentiles, Quantum uses an interpolation method similar to medint=0.
Special interpolation method Under certain special circumstances, regardless of the medint specified, Quantum reports the percentile as exactly halfway between the value at the percentile mark and the next value. This only happens when either there is an even number of respondents and no other respondent gave the same response as the percentile respondent, or more than one respondent gave the same response and the percentile respondent was the last one to give that response. You can tell when this happens because the cumulative value in the frequency distribution is exactly at the percentile mark.
152 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
To illustrate this, the example table has been altered so that there are now five respondents in the ‘Value is 2’ element and four in the ‘Value is 3’ element: Base Base
20
Value is 1
5
Value is 2
5
Value is 3
4
Value is 4
3
Value is 5
3
The tenth, median, respondent is now the last respondent who gave the value 2, so in the frequency distribution the cumulative value is exactly 50%. Regardless of the medint specified, Quantum reports the median as the value that is exactly halfway between the value at 50% and the next value; that is halfway between 2 and 3, that is 2.5.
✎ This special interpolation method only applies to percentiles calculated from numeric variables using inc=.
5.8 Printing the effective base Quick Reference To print an effective base which will not affect the count in any c=– elements, type: n31element_text[;options] To print an effective base which will affect the count in any c=– elements, type: element_text;effbase on an n01, n10, n11 or n15 statement.
Quantum uses a special base figure, called the effective base, to create T statistics on weighted tables. Without using this special base figure, it is possible that the statistics could produce significant results because the weighting has made adjustments. The effective base takes these adjustments into account and is calculated by dividing the squared sum of weighting factors by the sum of the squared weighting factors.
Statistical functions and totals – Chapter 5 / 153
Quantum User’s Guide Volume 2
☞ For a full explanation on the effective base and the formula used for its calculation, see section 7.3, ‘T statistics on weighted tables’ in the Quantum User’s Guide Volume 3.
When printing the effective base, you should take into account whether your tables include any special c=– conditions. These conditions can be used to produce a count of respondents who have not been included in any element since the last base in the axis. When making this calculation, Quantum ignores all respondents in the last base element, but includes all respondents in an effective base element created using the effbase keyword. This could result in no one appearing in the c=– element, thus defeating its purpose. For this reason, Quantum provides two methods for printing the effective base; these are described below. To define an effective base that will not affect the count in any c=– elements, type: n31element text[;options] For example: n31Effective Base;dec=2
To define an effective base when you are not specifying any c=– elements, and so there are no counts that will be affected, type: effbase on an n01, n10, n11 or n15 statement.
✎ effbase and n31 perform exactly the same calculations; the only difference is whether or not they affect the result of any c=– conditions.
☞ For further information about the special c=– conditions, see section 3.3, ‘Defining conditions for an element’.
154 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
5.9 Formulae The formulae for the statistics described in this chapter are given below. The table below shows a typical rating axis with a number of statistical values. The factors assigned to each element are shown in parentheses after the element text. Notice that the NA/DK element has no factor so it is excluded from the statistical calculations. The explanations of the formulae refer back to this table to illustrate how the figures were produced:
Base Very satisfied (5) Satisfied (4) No opinion (3) Dissatisfied (2) Very dissatisfied (1) NA/DK
Mean Standard deviation Standard error Sample variance
Base
18-24
25-34
35-44
45-54
22 3 3 6 4 4 2
8 1 0 2 2 2 1
5 2 2 0 0 0 1
4 0 1 3 0 0 0
5 0 0 1 2 2 0
2.8 1.35 0.30 0.09
2.4 1.40 0.53 0.28
4.5 0.58 0.29 0.08
3.3 0.50 0.25 0.06
1.8 0.84 0.37 0.14
In the formulae: n i is the number of respondents in row i of the column x i is the factor or increment associated with the ith cell N is the total number of respondents in each element included in the calculation (that is
∑ ni ).
A dot suffix indicates summation over the replaced index; so, for example, the formula for a column total is: r
n ·j =
∑ nij i=1
Statistical functions and totals – Chapter 5 / 155
Quantum User’s Guide Volume 2
Sum of factors x = ( ∑ ni xi ) Taking the column for respondents aged 18-24 in the sample table, the sum of factors is calculated as follows: (1×5) + (0×4) + (2×3) + (2×2) + (2×1) = 17
Mean
x =
ni xi ∑ ---------------N
Taking the column for respondents aged 18-24 in the sample table, the mean is calculated as follows. The sum of factors is 17 as described above, and the number of respondents included in the sum of factors is: 1+0+2+2+2=7 so the mean is 17÷7 which is 2.4. Viewed in relation to the element texts, this tells you that the mean rating given by 18-24 year-olds is between Dissatisfied and No opinion.
Standard deviation 2 1---
( ∑ ni xi ) 2 2 ∑ ni x i – ----------------------- N s = ---------------------------------------------- N–1 The standard deviation tells you the amount by which you would expect respondents’ answers to differ from the mean. For 18-24 year-olds this is: {[(1×52)+(0×42)+(2×32)+(2×22)+(2×12)-(172÷7)] ÷ (7-1)}½ = (11.61÷6)½ = 1.40 You would expect 67% of answer to lie within mean±std.dev; that is with in the range 2.4±1.4 (between 1.00 and 3.80).
156 / Statistical functions and totals – Chapter 5
Quantum User’s Guide Volume 2
Standard error of the mean The default formula for the standard error is:
s se ( x ) = -------N The standard error for the column 18-24 in the sample table is: 1.40 ÷ 7½ = 1.40 ÷ 2.65 = 0.53 You can be 95% certain that the mean score for the population as a whole will lie in the range mean±2std.err. In this example the population means should lie within the range 2.4±2×0.53; that is, somewhere between 1.34 and 3.46. The variation of the formula used when the run contains the useeffbase keyword is as follows. Let the sum of the squared weights, as calculated by the nsw statement, be: 2
wi =
∑ wik 2
k
where k moves through all respondents in the axis. Then, the effective base for a column is: 2
2
( wi ) ( wi ) - = ------------e i = ----------2 2 wi w ∑ ik The standard error is then:
se ( x ) =
2
s--ei
Sample variance of the mean sv ( x ) = ( se ( x ) )
2
The sample variance for the 18-24 column is: 0.53½ = 0.28
Statistical functions and totals – Chapter 5 / 157
6 Using axes as columns The text across the top of the table defining the contents of the columns is usually called the breakdown or banner, and is defined in the column axis. All axes may be used to create either rows or columns, so there is no need to write two versions of the same axis simply because at some times it forms the rows of an axis and at other times it forms the columns. There are three ways that Quantum can create column headings: •
Fully automatically using element texts. The column width is calculated by dividing the space available for column headings by the number of columns to be printed.
•
Semi-automatically using element texts and a user-defined column width defined with colwid= on the a, sectbeg, flt, tab or l statement or on the individual elements themselves.
•
Manually using heading texts defined on g statements and column widths defined on p statements.
6.1 Maximum width for column headings Before it prints any tables, Quantum calculates the maximum amount of space available for table headings using the formula: head_width = pagwid − (side + %_sign + pcpos_value) where: •
pagwid is the page width (default 132).
•
side is the width of the row text (default 24).
•
%_sign is an additional position needed at the end of each line to print the percentage sign for the last column.
•
pcpos_value is the amount of offset defined for percentages with the option pcpos=.
These last two options are ignored if there are no percentages, or if percentages are printed without percentage signs (nopc), or if there is no pcpos= option for this table. Any tables in which the amount of space required for the columns of the table is wider than this must be split. For example, suppose you have: a:pagwid=78;side=20;pcpos=-1
The amount of space for table headings is then: head_width = 78 − (20 + 1 + −1) = 58 characters. Using axes as columns – Chapter 6 / 159
Quantum User’s Guide Volume 2
6.2 Fully automatic set-up With this method, the width of the column is calculated automatically and the text of the breakdown is taken from the row text of the count-creating statements in the axis. Long texts are broken up by Quantum. The width of each column is calculated by dividing the maximum width available for the table heading by the number of columns required. If the table is 132 columns wide with a row-text width of 24 (both defaults), the maximum heading with will be: 132 − (24 + 1 + 0) = 109 characters If the axis has ten count-creating elements, each column will be allocated ten spaces. If there are 15 count-creating elements, each one would be seven characters wide. The maximum and minimum column widths allowed are 16 and eight characters respectively. If the result of the division is greater than 16, the column width is set to 16 characters; if the result is less than eight, the column width is set to eight characters. The overall column headings are also generated automatically. The top line contains the axis heading (from hd= on the l statement) centered across the entire breakdown. The second line contains the axis subheadings (from an n23 statement or hd= on a col or val) centered across the columns to which they refer. The text for each column is taken from the relevant n01/col/val statement. This text is split up above the column as logically as possible, using spaces, hyphens or slashes in the text as breakpoints. Column headings are right-justified and may be split over four lines. A simple example is: l region;hd=Area of Residence col 15;Base;hd=London;Inner London;Outer London; +hd=Southern England;Cornwall/Devon;Kent/Surrey/Sussex; ...
which will give us: Area of Residence London
Base
Inner London
Outer London
Southern England
Cornwall/ Devon
Kent/ Surrey/ Sussex
Here, we have made each column eleven characters wide. The axis heading ‘Area of residence’ is centered over all columns, including the base, whereas the axis subheadings are centered over the columns to which they refer. If you would prefer left or right justified subheadings, use hdpos on the n23 statements. 160 / Using axes as columns – Chapter 6
Quantum User’s Guide Volume 2
☞ For further information about the positioning of subheadings across columns, see ‘Laying out subheadings’ in chapter 3, ‘Introduction to axes’.
If the axis contains more than one n23 subheading, the text on each one will be centered above the elements between it and the next n23 or the end of the axis. If you want to alter this so that you can create blocks of text above the same group of columns, set up nested headings using hdlev= on the n23 statement.
☞ For information about setting up nested headings using hdlev=, see ‘Nested subheadings for column axes’ in chapter 3, ‘Introduction to axes’.
For example: l ban01 n23Visitors to the Museum;hdlev=1 n10Base n23Sex;hdlev=2 col 110;Male;Female n23Age;hdlev=2 col 111;11-20=’12’;21-34=’34’;35-44=’56’;55+=’78’ n23Visited;hdlev=2 n23Museum Before;hdlev=2 col 116;Yes;No
This might print as: Visitors to the Museum Sex Base
Male
Female
11-20
Age 21-34 35-54
55+
Visited Museum Before Yes No
If you would prefer to use a different text for when an element forms a column in a table, you may define this text with the option toptext= on the element. For example to replace the two-line heading Visited Museum Before with the single line Been Before, you would write: l ban01 n23Visitors to the Museum;hdlev=1 n10Base n23Sex;hdlev=2 col 110;Male;Female n23Age;hdlev=2 col 111;11-20=’12’;21-34=’34’;35-44=’56’;55+=’78’ n23Visited Museum Before;hdlev=2;toptext=Been Before col 116;Yes;No
Using axes as columns – Chapter 6 / 161
Quantum User’s Guide Volume 2
With the default of centralized texts, the headings might be printed as:
Base
Visitors to the Museum Sex Age Male Female 11-20 21-34 35-54 55+
Been Before Yes No
Absolute figures are printed with the right-most digit one print position to the left of the right-most character in the column heading. Percentages are printed with the right-most digit under the rightmost character in the column text, unless flush or pcpos are present on the a, sectbeg, flt or tab statement. If flush is used, percentages are printed directly under absolutes. For example: Without FLUSH (default): Male Female 44 56 31% 39%
With FLUSH: Male 44 31%
Female 56 39%
If pcpos is used, percentages are positioned according to the offset given: With PCPOS=-1: Male Female 44 56 31% 39%
With PCPOS=1: Male Female 44 56 31% 39%
When Quantum prints column headings, it prints two blank lines before the first line of text and one blank line after the last line. You may alter one or both of these settings using the keywords linesbef= and/or linesaft= on the a, flt, setbeg or tab statement. For example, if you type: a;linesbef=3;linesaft=2
Quantum will print three blank lines before column headings and two blank lines after them in all tables in the run.
162 / Using axes as columns – Chapter 6
Quantum User’s Guide Volume 2
6.3 Defining breakpoints in element texts Quick Reference To mark breakpoints in element texts for use when those texts are used to form column headings, use the characters ! or |.
When you have a long element text in a column axis, Quantum will normally fit as much text as possible in the column width. If the text is wider than the column, Quantum goes back to the previous space character and breaks the line there. If there are no spaces, Quantum breaks the line in the middle of words. Sometimes this method produces satisfactory column headings and other times not. One way round this is to define breakpoints for use only when the axis is used as the columns of a table. Quantum then splits the text at the breakpoints. The characters you use to mark breakpoints are exclamation marks and bars (! and | ). For example: n01Respon|dents Who!Did Not!Buy Bread;C=C125’2’
would create at most a four-line heading when the axis is used as a column axis: Respon dents Who Did Not Buy Bread
! and | are only applicable to column axes. If the axis is used as the rows of a table the ! and | are replaced by a space and nothing respectively. If you want to print either of these characters as part of the element text you must switch off their special meanings using either the qtform file or the QTFORM environment variable. Any changes you make in this way apply to the whole run, not just the axis in which you wish to print these characters. If you need to print ! as part of the element text but still wish to define breakpoints, remove the special meaning from ! and use | to mark the breakpoints.
☞ For further information, see section 9.2, ‘Column headings’ in the Quantum User’s Guide Volume 3.
Using axes as columns – Chapter 6 / 163
Quantum User’s Guide Volume 2
6.4 Defining column widths with colwid= Quick Reference To define widths for columns in table headings, type: colwid=num_spaces on the a, sectbeg, flt, tab or l statement, or on the individual elements themselves.
The option colwid=n defines the number of print positions to be allocated to a column. It may appear on a, flt, sectbeg, tab and l statements to define column widths for an axis, table, or group of tables, as well as being used on n, col or val statements to define column widths for individual items. Any texts which exceed the colwid= column width will be split at blanks, hyphens or slashes, or at the special characters ! and | . If colwid= is present anywhere in a run, it will override the automatic set-up for the tables or axes to which it refers. If colwid= is present at more than one level, the setting at the lowest level overrides those at any higher levels. For example, colwid= on an element overrides colwid on the l statement or higher for that element only. colwid= on an l statement overrides colwid on the a statement for that axis only.
6.5 Manual set-up Column headings are defined manually either when they differ from the row texts or when the automatic breakdown is not acceptable. The statements which do this are g and p. In certain circumstances, Quantum will ignore the heading texts on the g statements and will use the element texts instead. It will, however, retain the column widths defined on the p statements. Quantum ignores g statements when any of the following are true: •
Columns are suppressed by nzcol or smsup keywords.
•
The column axis is sorted by using sort on the l statement.
•
The table is sorted by using csort on the a, sectbeg, flt or tab statement.
•
The column headings defined on the g statements are too wide to fit on the page. In this case you’ll see the message ‘error: G-card width xx too wide for tab G space yy’ printed at the output stage of the run.
164 / Using axes as columns – Chapter 6
Quantum User’s Guide Volume 2
✎ When setting up a breakdown, make sure that each column is wide enough to accommodate the largest value to be set in the column. If the value has percentages as well as absolutes, the breakdown must be large enough to contain the percentages set one character to the right of the absolutes, unless flush or pcpos is used.
☞ For information on positioning percentages in columns, see section 6.2, ‘Fully automatic setup’.
The banner text Quick Reference To define column headings, type: g
col1_text[
col2_text ... ]
Column headings must be written on g statements exactly as they are to appear in the printed output. An axis may contain as many as 20 g statements grouped together to form blocks of column text. For example: g g g
Base ----
Marital Status Single Married Divorced ------ ------- --------
Widowed -------
An axis may contain more than one block of g statements as long as each group is followed by a p statement.
☞ For further information about the p statement, see section 6.6, ‘Printing numbers in columns’. The texts on each line of the second block will be placed adjacent to those on the first. Do not worry if some blocks have more g statements than others: Quantum always starts with the bottom line in each block, and adds extra spaces where necessary. g g g p g g g p
- - - - This is the First Block Base Column 1 Column 2 Column 3 ------------------------x x x x - Second Block - Column 5 Column 6 --------------x x
- - Column 4 -------x
Using axes as columns – Chapter 6 / 165
Quantum User’s Guide Volume 2
When printed in the table, the two blocks will be printed as one:
Base ----
- - - - This is the First Block - - Column 1 Column 2 Column 3 Column 4 -------- -------- -------- --------
- Second Block - Column 5 Column 6 -------- --------
Column headings start in the column immediately after the g, and are placed in the table in the column after the end of the side-text. Thus, if our row-text width is 24 characters, the column headings start in print position 25 unless you leave extra spaces before the leftmost text on the first block of g statements.
Spacing for groups of g statements When groups of g statements are placed side by side, Quantum does not leave any spaces in between the two unless you tell it to. This can be done in one of two ways: •
You may either insert the number of spaces required at the start of the headings on the second group of g statements.
•
You may place an ampersand (&) on the end of each of the first group of g lines in the column in which the texts from the second group are to start.
For example: /* Second g-block will start in column marked & g Base Single Married Divorced Widowed g ---------------------------p x x x x x gArea 1 Area 2 Area 3 g---------------p x x x
& &
is the same as: /*Second g-block starts with 3 spaces to separate col 5 from col 6 g Base Single Married Divorced Widowed g --------------- -------------p x x x x x g Area 1 Area 2 Area 3 g ---------------p x x x
166 / Using axes as columns – Chapter 6
Quantum User’s Guide Volume 2
6.6 Printing numbers in columns Quick Reference To define the positions in which cell counts will be printed relative to the column headings defined on g statements, type: p
x [x
.... ]
where x is any non-blank character.
Each group of g statements must be followed by a p statement showing where numbers are to be printed in relation to the column texts. The p statement is formatted as follows: p
x
x
...
where x is any non-blank character. Absolute figures are then right-justified in the columns marked with a character. Columns of figures may be separated by vertical lines. These are initiated by a vertical bar in the appropriate columns of the p statement, thus: l ax04 col 109;Base;Single;Married;Divorced;Widowed g Marital Status gBase Single Married Divorced Widowed p x | x | x | x | x
produces:
Base Male Female
Base 200 44 156
| | |
Single 44 6 38
| | |
Marital Married 122 27 95
Status Divorced | 33 | 10 | 23
| | |
Widowed 1 1 0
Using axes as columns – Chapter 6 / 167
Quantum User’s Guide Volume 2
6.7 Underlining column headings Quick Reference To underline text defined on g statements, type: un after the last g statement in a block. n is 1 to underline the whole text, 2 to underline everything apart from blank strings, or 3 to underline non-blanks only. Text on g statements may be underlined by placing a u statement immediately after the last g statement in a block. The format of the u statement is: un where n is 1, 2 or 3 and defines the type of underlining required: •
u1 underlines the whole line up to and including the last non-blank character.
•
u2 underlines the whole line (as u1) except that strings of blanks are not underlined.
•
u3 underlines non-blank characters only.
These correspond to unl1, unl2 and unl3 on n, col, val, fld and bit statements. Here is are the spec and table from the previous section updated to include underlining: l ax04 col 109;Base;Single;Married;Divorced;Widowed g Marital Status u2 gBase Single Married Divorced Widowed u1 p x | x | x | x | x
This produces:
Base Male Female
Base 200 44 156
| | |
Single 44 6 38
| | |
Marital Married 122 27 95
Status Divorced | 33 | 10 | 23
| | |
Widowed 1 1 0
If u does not meet your needs, you can enter your own underlining on a g statement with hyphens in the appropriate places. This is often useful in complex breakdowns using categories from more than one axis.
168 / Using axes as columns – Chapter 6
Quantum User’s Guide Volume 2
For example: l demog n10Base col 112;Under 30;30-50;Over 50 col 111;Male;Female g Age g Base Under 30 30-50 Over 50 g ---- ------------ -------
Sex Male ----
Female ------
If you will be converting your Quantum tables into a comma-delimited ASCII file using the program q2cda, you may want each column in the column heading to be treated as a separate text (the default is to treat each line as a single text). If so, you must underline the column texts, and each set of underlining must extend the full width of the column. Do not, however, use u for this type of underlining. Use = or – characters on a g statement instead since it is these characters, rather than the underlining character, that q2cda uses for finding the start and end of each column.
6.8 Splitting large tables When it is ready to print a table, Quantum checks whether it needs to split the table and, if so, where. To do this it adds up the column widths and compares the amount of space needed with the amount of space available. Quantum adds each column width separately and checks the amount of space needed after each addition. As soon as the amount of space required exceeds the amount of space available, Quantum splits the table just before the current column. For example, if the sum of columns A, B, C and D exceeds the amount of space available, Quantum will split the table between columns C and D. After a split, Quantum resets its counter to zero and starts counting again in case it is necessary to split the heading more than once. If you convert your tables for printing on a PostScript printer, the size of the font you use may make it possible to fit more columns on the page than in the standard format. Information on fonts is not available to Quantum at the time it formats the tables so it always splits tables as if they were to be printed in the standard format.
☞ For information about how Quantum paginates split tables, see section 4.7, ‘Pagination’.
Using axes as columns – Chapter 6 / 169
7 Creating tables Tables are created from axes, each cell being generated by the intersection of two conditions, one from the row axis and one from the column axis. In this chapter we will discuss the statements needed to produce various types of table and discuss methods of combining tables by addition and division.
7.1 Creating a table Quick Reference To create a table, type: tab [axis1] [axis2] [axis3] [axis4] row_axis column_axis [;options]
In order to create a table, Quantum needs to know which is the column axis and which is the row axis. If the table has more than two dimensions you will need to say which axes should be used for the extra dimensions. Each table must be created separately using a tab statement, as follows: tab row-axis column-axis Tab statements must precede the axes definitions in your program file.
Multidimensional tables Multidimensional tables are ones created from more than two axes. They occur when a series of tables has the same rows and columns, but each table in the group has additional characteristics which are themselves the conditions of other axes. This sounds complicated, so let’s take an example. Our basic table is of age by sex created by the tab statement: tab age sex
We have been asked to produce a separate table of age by sex for each region of the country. Whereas before each cell had two conditions (age and sex) it now has three (region, age and sex).
Creating tables – Chapter 7 / 171
Quantum User’s Guide Volume 2
There are two ways of writing this specification. You may either: •
write as many tab statements as there are regions, and filter each table of age by sex to include only those respondents resident in a given region, or
•
write a single tab statement to create a three-dimensional table.
Both methods produce the same results — the main advantage of the second method is that it involves you in a lot less work. The tab statement to create the multidimensional table is: tab region age sex
Now, if region has four rows and a base: l region col 135;Base;hd=Area of Residence;North;South;East;West
Quantum will provide us with five tables: 1. Base: Age by Sex (i.e., all respondents included). 2. North: Age by Sex. 3. South: Age by Sex. 4. East: Age by Sex. 5. West: Age by Sex. When these tables are printed, the region names from the col statement will be printed at the top of the table, as you can see from the sample table.
172 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
Absolutes/Col percents Area of Residence - North Q2. Age Base: All Respondents Base Base
153
11-20 yrs
39 25% 64 42% 38 25% 12 8%
21-34 yrs 35-54 yrs 55+ yrs
Male
Female
76
77
17 22% 36 48% 19 25% 4 5%
22 29% 38 36% 19 25% 8 10%
Figure 7.1 Multidimensional table Tables may have up to six dimensions: that is, up to six axes may be named on a single tab statement. It is difficult to visualize a four, five or six-dimensional table. The easiest way is just to think of the higher dimensions as extra conditions, and the multidimensional tab statement as a simpler way of writing them. Again, let’s work through an example. This time we need a four-dimensional table using the axes mstat, region, age and sex: tab mstat region age sex
Age and sex are the rows and columns respectively, region is the third dimension and mstat (marital status) is the fourth. Mstat is set up as follows: l mstat col 134;Base;Single;Married;Divorced;Widowed
so the tables created will be: 1. 2. 3. 4. 5. 6. 7.
Mstat Base:
Single:
Region Base: North: South: East: West: Region Base: North: . . .
Age by Sex Age by Sex Age by Sex Age by Sex Age by Sex Age by Sex Age by Sex
Creating tables – Chapter 7 / 173
Quantum User’s Guide Volume 2
The first table of age by sex is for all respondents, since the conditions defined by the higher dimensions are both ‘All respondents’ (that is, Bases). The seventh table is a cross-tabulation of age by sex for all respondents who are single and live in the North. Altogether this tab statement produces 25 tables because there are five rows in the third and fourth dimension axes. If the tab statement has options on it, they will apply to all the tables in the set. All tables will have different page numbers, but they will all have the same table number.
7.2 Options on the tab statement All options that are valid on the a statement, apart from dp and netsort, are also valid on a tab statement. Since tab is the fourth level down in the hierarchy of the tabulation section, any option occurring at a higher level will be overridden by that same option at the tab level. Thus, dsp set globally may be overridden by nodsp for a specific table; dec=2 set globally may be reset to dec=1 for the current table only. The exception to this is the option c= which is additive at lower levels. If a group of tables has the condition c=c12’1’ and one of that group of tables also has the condition c=c15’6’, that table will only include people for whom both conditions are True (that is, c=c12’1’.and.c15’6’).
☞ For information about the options that are valid on a, sectbeg, flt and tab statements, see ‘Options on a, sectbeg, flt and tab statements’ in chapter 2, ‘The hierarchy of the tabulation section’. Additional options which may be used at tab level are: celllev=name This is used with analysis levels to define the level at which cell counts are to be incremented for the table.
☞ For further information on analysis levels, see ‘Table creation level’ in chapter 3, ‘Dealing with hierarchical data’ in the Quantum User’s Guide Volume 3. id=name
This assigns an identifier of up to six characters to the table for use in table manipulation or special T statistics.
☞ For further information about table manipulation, see ‘Referring to tables in the current run’ in chapter 2, ‘Row and table manipulation’ in the Quantum User’s Guide Volume 3. For further information about special T statistics, see chapter 7, ‘Special T statistics’ in the Quantum User’s Guide Volume 3.
174 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
keep[=type]
Selects a table for use in a percentage difference calculation. The other table in the calculation must be marked with either op=A or op=B. The calculation of differences may be based on rounded or unrounded percentages. The default is to use unrounded figures. Type keep=print to use rounded percentages or keep=value (or just keep) to use unrounded percentages.
op=A/B
Selects a table for use in a percentage difference calculation. The other table in the calculation must be marked with keep. If the current table is marked with op=A, Quantum will calculate differences by subtracting the percentages for the current table from the corresponding ones of the kept table. If the current table is marked with op=B, the differences will be the results of subtracting the percentages in the kept table from those in the current table.
☞ For further details on percentage differences, see section 4.9, ‘Percentage differences’.
Cross-tabulating data variables Quick Reference To cross-tabulate two data variables, type: tab ccol_num1 ccol_num2
When we were discussing the edit section, we said that the holecount was a useful means of gaining an overall view of the data. A similar facility exists in the tabulation section for seeing how respondents are distributed across the cells of the table. To produce a test table very quickly, all you need do is type: tab cm cn where m and n are column numbers. This produces a table in which the rows are the twelve positions (1/&) in cm and the columns are the twelve positions (1/&) in cn. In a table of c15 by c34 the cell for position 4 by position 3 would tell us the number of respondents who had c15’4’ and c34’3’.
Creating tables – Chapter 7 / 175
Quantum User’s Guide Volume 2
7.3 Multilingual surveys Quick Reference To declare a Quantum run as multilingual, type: lang=language on the a statement. Where language is the one to three character code of the default language for axis texts; that is, the language the axis texts are entered in and the default language in which they are printed in tables. To define the language in which you want to print the axis texts in tables in a multilingual project, type: lang=language on the tab statement. Where language is the code of the required language.
Multilingual surveys are those that are carried out or analyzed simultaneously in different languages. For example, a survey that is conducted in Dutch in The Netherlands and in English in England. In Quantum you can declare a survey as multilingual and define the survey’s main or default language. In multilingual surveys, a project text file stores the axis texts in the survey’s default language and their translations in one or more other language. Project text files have a file name extension of .ptf and are referred to as ptf files. When you compile a multilingual survey, if a ptf file does not already exist, Quantum creates one, names it db.ptf, incorporates the axis texts into it and tags them with the language code defined on the a statement. However if a ptf file already exists, Quantum does not create a new one, but incorporates the axis texts into the existing file. If there is more than one ptf file, Quantum uses one named db.ptf in preference to any others. If there is more than one ptf file and none are called db.ptf, Quantum uses the first one it encounters. Quantum compares all the default language axis texts with the texts that are already in that language in the selected ptf file: •
When Quantum finds exactly matching text, it does not add the text to the ptf file because the existing translations can be used.
•
When there is no matching text, Quantum adds the text to the ptf file, so it can then be translated.
176 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
After compilation, your translator can add the necessary translations to the ptf file using Qolyglot, the SPSS MR translation utility. You can then print the tables in any of the languages for which translations are available.
✎ Do not edit the ptf file manually as its format and syntax are extremely sensitive. Always use the Qolyglot translation utility to add the required translations.
To declare a Quantum run as multilingual, type: lang=language on the a statement. Where language is the one to three character code of the default language for axis texts; that is, the language the axis texts are entered in and the default language in which they are printed in tables. For example, lang=eng for English and lang=nld for Dutch.
✎ You need to ensure that the language codes you specify with the lang keyword correspond to the language codes defined in the qolyglot.ini file.
☞ For further information, see ‘Changing the list of available languages’ in the Qolyglot Translation Utility Manual.
To define the output language for the axis texts in tables in a multilingual Quantum run, type: lang=language on the tab statement. Where language is the one to three character code of the required language. For this to be successful, translations must be available in this language in the ptf file.
Creating tables – Chapter 7 / 177
Quantum User’s Guide Volume 2
7.4 The and statement Quick Reference To request a series of tables with a common axis, type a tab statement for the first table and follow it with: and[n] axis1 [axis2 ... ] where n is blank or 1 for row axes, 2 for column axes and 3 to 6 for higher dimensions.
The tab statement and is very useful if you have to create a series of tables using the same row, column or higher dimension axis. For instance, to set up a series of tables all of which have the same row axis, we could write: tab ax01 bk01 tab ax01 bk02 tab ax01 bk03 tab ax01 bk04 but it is much quicker and more efficient to write: tab ax01 bk01 and bk02 bk03 bk04
Our example will produce four tables •
ax01 by bk01
•
ax01 by bk02
•
ax01 by bk03
•
ax01 by bk04
Each and statement may contain any number of axes as long as they are separated by spaces and the total length of the statement does not exceed 200 characters. Any text associated with the table specified on the tab statement also applies to the tables created using the axes on the and line. By default, each table in the series will have a different table number and page number. You may, if you prefer, use the option nand on a tb statement to cause all tables created by ands to have the same table number as the parent table.
☞ For further information about the tb statement, see section 8.5, ‘Table numbers’.
178 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
There are also and statements for defining additional rows or higher dimension axes. They are and2 to and6, where the number following and is the dimension number of the axis. Incidentally, and for rows may also be written and1. As you can see, the dimension number is found simply by counting the number of axes in the table, starting with the column (right-most) axis. Any number of ands may follow a tab statement as long as they are all of the same type; that is, all and or all and2; a mixture is not acceptable.
7.5 Combining tables Tables may be combined horizontally or vertically, or their contents may be added together or divided one by the other. The statements controlling these functions are: •
sid — place this table to the right of the previous one.
•
und — place this table underneath the previous one.
•
add — add this table to the previous one.
•
div — divide the previous table by this one.
These statements may not stand alone: they must always follow a tab statement defining the parent table. For example, with und, the tab statement would define the table to be printed at the top of the page while und would define the table to be printed underneath that table. All tables combined with these statements must generate the same number of cells in order for them to be matched correctly. Where tables are of differing sizes the smaller tables should be padded with dummy elements as shown in the examples which follow.
Horizontal and vertical combination Quick Reference To place tables side by side, type a tab statement for the first table and follow it with: sid row_axis column_axis [;options] Options are any of anlev=, c=, celllev=, inc=, maxim, means, median, minim and wm=. To place tables one underneath the other, type a tab statement for the first table and follow it with: und row_axis column_axis [;options] Options are any of anlev=, c=, celllev=, inc=, maxim, means, median, minim and wm=.
Creating tables – Chapter 7 / 179
Quantum User’s Guide Volume 2
As we mentioned in section 7.4, ‘The and statement’, there are times when you have several tables all using the same row or column axis. We also said that such tables could be specified more efficiently by using and statements. However, this prints each table on a separate page, making it difficult to compare figures in different tables. The Quantum statements sid and und provide a means of printing two or more tables on the same page, either side by side or one underneath the other, making comparisons simpler. There are, however, some provisos. If sid is used: •
The overall width of the tables must not exceed the designated table width. The default is 132 characters — this may be changed by using pagwid= on the a statement.
•
The tables must be two-dimensional.
•
All tables must contain the same number of rows.
•
A maximum of 40 sid statements are allowed per tab statement.
•
If more than one table contains statistics such as means (n12) or standard deviations (n17) you must create the statistics using n25 statements in the axes rather than fac= options on the elements. If you use factors, Quantum takes the factors as they are defined in the earliest table in the group and applies them to all subsequent tables, overriding the factors defined for those tables.
When you use und: •
All column axes must have the same number of columns.
•
The tables must be 2-dimensional.
•
The total number of elements in all axes in the table must not exceed 500.
Sid and und are formatted as follows: sid axis1 axis2;[options] und axis1 axis2;[options] where axis1 and axis2 are the axes forming the table, and options are any of the keywords: • • • • • • •
anlev= c= celllev= inc= maxim means median
180 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
• •
minim wm=
Output options such as the number of decimal places for absolutes, or the amount of spacing between lines in the output are taken from the tab, flt, sectbeg or a statement in that order.
✎ A table created using tab with sid or und has become one table by the time output options are applied at the table formatting (qout) stage of the run. This means that any output options are applied to all elements in both the tab table and the sid or und table. Quantum does not apply output options to the tab and sid/und tables independently and then merge the tables. So, for example, if you place sort on the tab statement of a tab/und pair, Quantum places the two tables one underneath the other and from then onwards treats the figures as a single table. At the output stage the figures are sorted with no distinction between the tab section and the und section.
☞ For a full list of output options, see ‘Options on a, sectbeg, flt and tab statements’ in chapter 2, ‘The hierarchy of the tabulation section’.
Any table headings for the second table must be entered as part of the text following the tab statement. If you are printing tables side by side and you want to define the layout of the column headings yourself, you must place the g/p statements in the axis which defines the columns and codes for each element, not all in the one named on the tab statement. For example: tab rating sex sid rating region l rating col 120;Base;Very Good;Good;Bad;Very Bad l sex col 110;Base;Male;Female g Sex g Base Male Female p x x x l region col 111;North;South;East;West g Region g North South East West p x x x x
Creating tables – Chapter 7 / 181
Quantum User’s Guide Volume 2
If percentage figures are requested or the table is to be sorted (ranked), these tasks are carried out once the tables have been arranged. With sid, if both column axes have base columns, row percentages for the tab and sid tables will be created using the appropriate base column. If the tab column axis has a base, but the sid one does not, row percentages for the whole table will be generated using the base from the tab column axis. If there is no base in the tab column axis, but one exists in the sid column axis, row percentages will be created for the sid table but not for the tab table. Up to 40 sids and any number unds may follow the tab as long as the overall limits for table sizes are not exceeded.
Adding tables Quick Reference To add tables, type a tab statement for the first table and follow it with: add[row_offset[,col_offset] ] axis_names where axis_names is the same number of axis names as appears on the tab statement.
Another way of combining tables is to add them together. Quantum can add tables by placing them one on top of the other and adding the corresponding cells in each table, or by offsetting them so that, for example, the cells in row 1 of the first table are added to those in row 3 of the second. The easiest way of adding two tables is to add all cells in the first row of the first table to the corresponding cells in the first row of the second table, and so on. All that’s needed is a tab statement to create the first table followed by an add statement generating the second, for example: tab ax01 bk01 add ax02 bk02
Here we are creating the table ax02 by bk02 and adding it to the table ax01 by bk01. A practical example might be an office equipment survey in which a set of 3-column fields store the number of different makes of typewriter that each company owns. If the first ten fields refer to manual typewriters and the next ten refer to electric typewriters, we may want a table showing the total number of typewriters of each brand owned.
182 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
If we write: tab manbrd comsiz;c=c(123,149)u$ $ add elecbrd comsiz;c=c(151,175)u$ $ l manbrd n10Base n01Brand A;inc=c(123,125) n01Brand B;inc=c(126,128) . l elecbrd n10Base n01Brand A;inc=c(151,153) n01Brand B;inc=c(154,156) .
the row for Brand A will tell us how many Brand A manual and electric typewriters each company owns. Notice that we are using inc= to count the number of typewriters rather than using c= to note the presence or absence of typewriters.
✎ In this example, all of the figures are added together, including the base row. This can result in misleading base figures. You can avoid this situation either by using a dummy base row in the second table, or by removing the base row from the second table and using the add with offset feature, as described below.
Offsets with added tables Tables to be added may be offset by any number of rows or columns; that is, the table defined by add may be shifted a number of columns to the right or down a given number of rows before the cells are added. For instance, you may want to add cell 2 of row 3 in the first table to cell 1 of row 1 in the second table. This is an offset of 2 columns and 3 rows. To offset a table by a given number of columns, the add statement must be entered as: addn axis1 axis2 where n is the number of columns towards the right that the table is to be shifted before it is added to the tab table. Note that there is no space between the keyword add and the offset. So, tab ax01 bk01 add3 ax02 bk02
shifts the second table three columns to the right before adding it to the first table: column 3, row 1 of ‘ax01 by bk01’ will be added to column 1, row 1 of ‘ax02 by bk02’, and so on.
Creating tables – Chapter 7 / 183
Quantum User’s Guide Volume 2
To add tables with vertical offsets, the notation is: addm,0 axis1 axis2 ... [axis6] where m is the number of rows to offset. When doing this, you must be sure to enter a zero for the column offset otherwise Quantum will combine the tables horizontally instead. A single number after add is assumed to be a column offset: add5 ax01 bk01 has an offset of 5 columns add5,0 ax01 bk01 has an offset of 5 rows To define row and column offsets for the same table, we write: addm,n axis1 axis2 ... [axis6] where m is the row offset and n is the column offset. If the row or column axis contains an n25 statement, remember that it creates three elements even though none of them are printed in the table. A tab statement may be followed by any number of adds with the same or varying offsets.
✎ Offsets are always based on the tab table rather than on the intermediate adds themselves. For example: tab ax01 bk01 add2 ax02 bk02 add2,1 ax03 bk03
takes the table ax02 by bk02, offsets it by 2 columns and adds it to the tab table. Then the table ax03 by bk03 is offset by 2 rows and 1 column and added to the tab table. To clarify this further let’s look at some numbers — the tables shown below are the individual tables before adding takes place:
184 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
ax01 by bk01 c2 c3 c4 9 3 0 4 2 0 5 1 0 0 0 0 0 0 0
r1 r2 r3 r4 r5
c1 12 6 6 0 0
r1 r2 r3
ax02 by bk02 c1 c2 c3 7 2 5 3 2 1 4 0 4
c5 0 0 0 0 0
r1 r2 r3
ax03 by bk03 c1 c2 c3 5 4 1 4 3 1 1 1 0
By adding the first add table (ax02 by bk02) to the tab, we have:
r1 r2 r3 r4 r5
c1 12 6 6 0 0
c2 9 4 5 0 0
c3 10 5 5 0 0
c4 2 2 0 0 0
c5 5 1 4 0 0
This table is only temporary and it is never printed, but as you can see, the numbers in column 3 are the sum of the numbers in column 3 of table 1 and column 1 in table 2. The next step is to add the table created by the second add to this temporary table. Remember that the offsetting is based on the original table rather than the previous add, so, ignoring the row offset for the moment, we will be adding column 1 of table 3 to column 2 of table 1, which is also column 2 of the temporary table. The row offset is 2, so row 1 of the third table is added to row 3 of the first table. The final printed table is as follows:
r1 r2 r3 r4 r5
c1 12 6 6 0 0
c2 9 4 10 4 1
c3 10 5 9 3 1
c4 2 2 1 1 0
c5 5 1 4 0 0
The number 9 in r3c3 is the sum of table 1 r3c3, table 2 r3c1 and table 3 r1c2; that is, 1+4+4=9.
Creating tables – Chapter 7 / 185
Quantum User’s Guide Volume 2
Dummy elements with offset tables Because of the way Quantum creates tables, you must make sure that the axes on the tab statement have as many rows or columns as there will be in the final table (see output of ax01 by bk01 above). To do this it may be necessary to pad these axes with dummy n01 statements. If the dummy elements are omitted, any extra columns or rows in the other axes will be ignored when the tables are added. All row and column headings are taken from the axes on the tab statement, so the dummy elements should also define any texts that are to be used for the additional rows and columns. If no text is given, the rows and columns will be printed without headings. In our example, the original table has three rows and columns compared to five of each in the final table, therefore we must pad out the axes ax01 and ax02 so that they too have five each. For example: l ax01 col 27;r1;r2;r3 n01r4;dummy n01r5;dummy
If the axis is later used in another table, the dummy rows are ignored. If you fail to allow sufficient rows and columns in added tables with offsets, you may well find that counts for some cells are larger than you would expect because counts for the ‘extra’ cells have been added into the next valid cell in the table. Any of the options listed in section as valid on sid and und statements may also be used on an add statement.
Dividing one table by another Quick Reference To divide one table by another, define the top table on a tab statement followed by: div axis_names [;options] where axis_names is a list of as many axis names as there are on the tab statement, and options is any of the keywords anlev=, c=, inc=, maxim, means, median, minim or wm=.
186 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
When tables are divided, the table on the tab statement is always the numerator (table to be divided) and the table on the div statement is the denominator (table by which to divide). Both tables must have the same number of rows and columns since the final table is achieved by placing tables on top of one another and dividing the corresponding cells. If the division for a cell has a remainder, the result is rounded up to the next highest whole number. Where a cell in the second table is zero, the corresponding value in the first table remains unchanged; for example, 4÷0 gives a value of 4. Only one div statement may follow a tab — any more will be ignored. The format of the div statement is: div axis1 axis2 ... [axis6];[options] where options are any of the keywords: • • • • • • • •
anlev= c= inc= maxim means median minim wm=
Output options such as the number of decimal places for absolutes, or the amount of spacing between lines in the output are taken from the tab, flt, sectbeg or a statement in that order.
☞ For a full list of output options, see ‘Options on a, sectbeg, flt and tab statements’ in chapter 2, ‘The hierarchy of the tabulation section’.
The statements: tab ax06 loaf;inc=c(132,133);dec=2 div ax06 loaf
produce a table showing the number of loaves bought per person. The tab table creates a table containing the total number of loaves bought whereas the div table contains the number of people buying bread. The axes are the same; the difference is inc= on the tab line. By dividing the first by the second we arrive at the average number of loaves bought per person.
Creating tables – Chapter 7 / 187
Quantum User’s Guide Volume 2
7.6 Printing more than one table per page Quick Reference To print more than one table per page use: hitch=number to print the first page of the current table on the same page as the previous table, or: squeeze=number to print as many pages of the current table as there is room for on the same page. In both cases, number determines how Quantum deals with table titles, footnotes and bottom texts. Acceptable values for hitch= are 0 to 4 and for squeeze= are 0 to 2.
✎ The hitch and squeeze options are not available for PostScript tables. There may be times when you will want to print more than one table on a page. The und statement described earlier in this chapter will do this, but it is only useful if the two tables have the same column axis, and you want Quantum to treat the two tables as a single table. When this is not what you want, you should find that the keywords hitch= and squeeze offer a solution. Examples of when you will find hitch or squeeze useful are: •
When you want to suppress page breaks between tables simply to save paper on test or checking runs.
•
When you have a short but very wide table and you want to print the continuation page of the table on the same page as the first part.
•
When you have a number of short tables that would look satisfactory printed on the same page.
•
When you have tables with T statistics on overlapping data that you want to print one underneath the other, and und does not produce the correct results.
✎ If you use hitch or squeeze in a table specification which contains n09s to force page breaks, Quantum ignores the n09 statements.
The hitch= and squeeze= keywords are both valid on the tab statement. Exactly how Quantum prints your tables depends on which values you assign to these keywords. The following table summarizes these values and specific examples are given later.
188 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
Option
Action
hitch=0
Starts the current table on a new sheet of paper (the default).
hitch=1
This prints the first page of the table immediately below the previous table, if there is room on the physical page for all of it.
hitch=2
As hitch=1 but suppresses bot and foot texts and titles that are identical to those on the previous table, and inserts the current table between the end of the previous table and its foot/bot texts, if any.
hitch=3
Prints the column headings and rows of the current table before the footnotes or bottom texts of the previous table. If squeeze=1 this continues for as many pages as can fit on the physical page.
hitch=4
As hitch=3 but prints only the rows (and not the column headings) of the current table before the footnotes or bottom texts of the previous table. If squeeze=1 this continues for as many pages as can fit on the physical page.
squeeze=0
Prints each page of a table on a separate physical page (the default).
squeeze=1
In tables which spread over more than one page, this prints as many pages of the table as possible on each physical page.
squeeze=2
As squeeze=1 but suppresses bot and foot texts and titles that are identical to those on the previous table, and inserts the current table between the end of the previous table and its foot/bot texts, if any.
You may use hitch= and squeeze= singly or together. The sections which follow explain how various combinations produce different types of layout. When you use hitch= or squeeze=, Quantum calculates the amount of space remaining in the page by subtracting the number of output lines used on the page so far from the maximum number of output lines allowed on the page. The number of output lines allowed on the page is 60 by default, but it can be adjusted by using the paglen option on the a statement.
Creating tables – Chapter 7 / 189
Quantum User’s Guide Volume 2
A set of short tables that do not exceed the page width You use hitch=1 when you want Quantum to print the current table, or if it is a multipage table, its first page, on the same physical page as the previous table. If there is not enough room for this to happen Quantum ignores the request. For example: tab choice1 agesex; tab choice2 region;hitch=1
defines two tables that will be printed on the same page if there is room. If the second table is longer than one page, Quantum will print the first page on the same page as the first table and will print the second page on a new sheet as it normally does. You’ll find hitch=1 by itself useful if you have a set of short tables and you want to suppress the page break between them.
Short tables with wide breakdowns You use squeeze=1 with tables that spread over more than one page, to tell Quantum to fit as many pages of the table as possible on one printed page. You might use this if you have a short table with too many columns to fit across the page. Generally, when Quantum finds a table that is too wide to print on one page, it prints as many columns as it can on the first page and then starts a new page and prints the remaining columns. However, by specifying squeeze=1 you can force Quantum to print the two parts of the table on the same page if there is room. For example: tab region cartype;squeeze=1 l region col 110;Base;North;South;East;West l cartype n10Base n23Ford;unl1 fld c(136,140); ..codes for Ford cars n09 n23Volkswagen/Audi;unl1 fld c(136,140); ..codes for Volkswagen/Audi cars n09 n23BMW;unl1 fld c(136,140); ..codes for BMW cars
190 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
When you use squeeze=1 by itself, Quantum squeezes tables onto one page simply by suppressing the page break that it would normally insert between pages. Titles that would normally be printed at the top or bottom of each page are still printed for each table page, even if it means that the same text appears twice or more on the same printed page. You can suppress some or all these titles by specifying a different value for squeeze as described below in ‘Controlling titles, footnotes and bottom text’.
☞ For further information about how Quantum splits and paginates very wide tables, see section 4.7, ‘Pagination’.
Paper saving The way to save most paper is to use hitch=1 and squeeze=1 on the same tab statement, as shown below: tab likes1 demog;squeeze=1 tab likes2 demog; hitch=1;squeeze=1
This example defines two tables, both of which may spread over more than one page. squeeze=1 on the first line tells Quantum to fit as many pages as possible of that table on each printed page. hitch=1 and squeeze=1 on the second line tell Quantum to print the first page of this table on the same page as the last page of the previous table, and to continue printing as many pages as possible on each physical page until it reaches the end of the table. This combination is handy if you just want a draft set of tables to check before printing the final copy, or if you are using continuous stationery where page breaks may not be important.
Controlling titles, footnotes and bottom text As the examples so far have explained, setting hitch or squeeze to 1 suppresses page breaks but does not do anything with the table texts themselves. You will often find that you can improve the appearance of the printed page by suppressing some or all of the titles for the second and subsequent tables. As an illustration of what can be achieved, consider the following table that was created by the specification: a;op=1 ttcWASHING POWDER SURVEY bot ttlPrepared for XYZ Marketing tab prefer ban1;squeeze=1 ttlBrand preference foot ttl*Biological powders only
Creating tables – Chapter 7 / 191
Quantum User’s Guide Volume 2
The table that this spec creates is shown in Figure 7.2.
WASHING POWDER SURVEY Page 1 Absolutes Brand preference ------SEX-----Total Male Female Base 250 142 108 Brand A 88 52 36 Brand B 56 29 27 Brand C 33 14 19 Brand D 22 14 8 Brand E 51 33 18 *Biological powders only
------------AGE------------11-20 21-34 35-54 55+ 58 104 66 22 17 44 24 3 19 24 10 3 9 12 9 4 6 9 7 7 15 17 12
Prepared for XYZ Marketing WASHING POWDER SURVEY Page 2 Absolutes Brand Preference -----REGION----TOTAL North South Base 250 142 108 Brand A 88 77 11 Brand B 56 41 15 Brand C 33 26 7 Brand D 22 15 7 Brand E 51 42 9 *Biological powders only
---BIO USER--Yes No 112 138 48 40 25 31 14 19 9 13 16 35
Prepared for XYZ Marketing
Figure 7.2 Wide table with squeeze=1 There are a number of ways you can improve this table simply by controlling the table titles, footnotes and bottom text. The way to do this is to use squeeze=2.
192 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
If you create these tables with squeeze=2, Quantum still prints the first page of the second table on the same page as the previous table but it also: •
Ignores bot text on the first page.
•
Suppresses title lines that are identical to the previous page until it finds a non-identical title line. Trailing spaces are ignored in comparisons.
✎ Quantum considers not only tt texts as titles but also table numbers, page numbers and output type descriptions. If you want to suppress all titles at the top of the page you must suppress page and table numbers on that table. If the output types are different you may need to suppress them too. •
Prints the second page between the foot text and the bot text of the first page.
•
Removes the foot text from the first page if it is identical to the foot text of subsequent pages. Trailing spaces are ignored in comparisons.
If you look back to the previous figure, you’ll see that Quantum still prints the page numbers as they would appear on separate pages. You can further improve the table’s appearance by either suppressing page numbers (by placing nopage on the a statement), or by specifying that the pages should be numbered physically and not logically (by placing physpag on the a statement).
☞ For further information on the physpag keyword, see ‘Logical and physical page numbers’, later in this chapter The effect of joining the two tables in the previous example using squeeze=2 is shown in Figure 7.3.
Creating tables – Chapter 7 / 193
Quantum User’s Guide Volume 2
WASHING POWDER SURVEY Absolutes Brand preference
Base Brand Brand Brand Brand Brand
A B C D E
Total 250 88 56 33 22 51
------SEX-----Male Female 142 108 52 36 29 27 14 19 14 8 33 18
------------AGE------------11-20 21-34 35-54 55+ 58 104 66 22 17 44 24 3 19 24 10 3 9 12 9 4 6 9 7 7 15 17 12
-----REGION----TOTAL North South Base 250 142 108 Brand A 88 77 11 Brand B 56 41 15 Brand C 33 26 7 Brand D 22 15 7 Brand E 51 42 9 *Biological powders only
---BIO USER--Yes No 112 138 48 40 25 31 14 19 9 13 16 35
Prepared for XYZ Marketing
Figure 7.3 Wide table with squeeze=2 Now that you have seen what can be achieved, you may be interested to know more about how Quantum decides whether to suppress titles, in case you have tables in which you expected Quantum to suppress text and it did not. When it compares titles on tables, Quantum generally looks at blocks of titles rather than individual lines. When comparing the footnotes of the two tables, Quantum compares all the tt texts for the first table with all the tts for the second and suppresses the footnote for the second table only if the two blocks are identical. If the two footnotes have the same first line but different second lines, Quantum sees the blocks as different and prints each footnote in full below the table to which it belongs. When Quantum compares titles at the top of the table it again looks at the titles as a block, only this time it suppresses titles on the second table as long as they are identical to the corresponding title lines for the first table. In the tables shown here, the job title, the output type description, and the first title line are identical for both tables so Quantum prints them at the top of the first table only.
194 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
When comparing table titles, Quantum also considers table numbers, page numbers, and output type descriptions. In some circumstances, this could prevent Quantum from suppressing otherwiseidentical table titles. If you look back to Figure 7.2, you will see that Quantum has numbered the first table as Page 1 and the second table as Page 2. In this case, Quantum would see the different page numbers, stop comparing the title texts and repeat the table titles at the top of the second table. The same would happen if you had table numbering set. There are two ways you can get around this: •
You can suppress page and table numbering (by placing nopage or notbl on the a statement);
•
You can print the physical page numbers, rather than the logical page numbers.
☞ For further information on printing physical page numbers, see ‘Logical and physical page numbers’, later in this chapter
Pasting one table underneath another If you have two one-page tables with the same column headings you can paste just the rows of the second table under the rows of the first table so that the printed table looks like a single table (similar to the types of tables you can create with und but without the restrictions). Write your table specs as usual and place the keyword hitch=4 on the tab statement of the second table. For example: tab likes region tab dislike region;hitch=4
The table created by this spec would look line a single table. The table titles and column headings would come from the first table. These would be followed by the elements from likes and the elements from dislike just as if they had been specified as a single axis. If you have been having trouble using und with tables with T statistics on overlapping data you should find that using hitch=4 solves your problems.
Creating tables – Chapter 7 / 195
Quantum User’s Guide Volume 2
Logical and physical page numbers By default, Quantum does not recalculate page numbers to take into account changes made by hitch and squeeze. So, if you have three tables which would normally be printed on pages 1, 2 and 3, and you use hitch=2 to print tables 1 and 2 on the same page, the page number printed on table 3 will still show page 3 even though it is now physical page 2. You can use the physpag keyword to request that the physical page numbers are printed rather than the logical page numbers. To request this, type: physpag on the a statement. Then, the same three tables would be physically numbered as follows: tables 1 and 2 would have Page 1 printed above them, and table 3 would have Page 2 printed above it. If you do not want tables 1 and 2 to both be numbered Page 1, you could use the relevant hitch or squeeze option to suppress identical table titles, thereby also suppressing identical page numbers.
✎ If you have physpag in the default options file, you can override this by specifying nophyspag on the a statement in your program.
7.7 Suppressing percentages and statistics with small bases Quick Reference To suppress percentages or statistics in a cell if the base is less than a value of your choice, place the option: smbase=number on the a, sectbeg, flt or tab statement.
The smsup group of options suppress all the figures in a cell if the specified values (absolutes or percentages) are below a given value. The smbase= option allows you to suppress just percentages in a cell without also suppressing the absolutes, if the base for the percentage is less than a figure of your choice. You may use it on the a, sectbeg, flt or tab statement and its setting at a higher level will carry through to all lower levels, unless specifically overridden at a lower level, as is the case with most a-statement options.
196 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
What are ‘percentages’ and ‘statistics’? When suppressing percentages with small bases, the word percentage means any of the following: op=& op=0 op=2 op=5 op=6 op=8 op=A op=B
Total percentages Row percentages Column percentages Column percentages printed for base row Column percentages on most recent as well as first base Indices Percentage differences (last element minus current element) Percentage differences (this element minus last element)
Tables that are specified without any of these output types, either explicitly with op= on the tab statement or implicitly from an op= carried over from a higher level, are not subject to small percentage suppression even if the run requests it. (This allows you to specify smbase on the a statement but prevents Quantum from manipulating the output options for tables, such as those with absolutes only, where small percentage suppression is inappropriate.) The word statistics refers to: n12 n17 n19 n20
Mean Standard deviation Standard error Sample (error) variance
All other statistics are always left untouched regardless of the size of the base.
Requesting suppression To request suppression of column percentages from small bases, type: smbase=number;smcol where number is an integer or real number greater than zero. Specifying a suppression value of 0 or 0.0 effectively switches small percentage suppression off unless you have tables with bases less than zero. Column suppression is the default, so if you forget to specify the type of percentages you wish to suppress this is what Quantum will do. It applies to all types of percentages except row percentages. To request suppression of row percentages with small bases, type: smbase=number;smrow You can, of course, use smcol and smrow together to suppress all percentages from small bases. Creating tables – Chapter 7 / 197
Quantum User’s Guide Volume 2
How suppression works The notes that follow explain how Quantum applies small percentage suppression. They use column percentages as an example, but the same rules apply to row percentages. Just substitute the word row wherever you see references to columns, and vice versa. When Quantum creates a table where small percentage suppression is possible, it looks at each cell separately and checks which output types have been requested for that cell. If the cell belongs to a row that is not a statistic Quantum then compares the most recent base for the current column with the smbase value. If the column base is less than the smbase value Quantum switches off all percentage output types for the current cell. If the cell is part of a statistical row, Quantum compares the total number of respondents contributing to the statistic (the sum-of-n) with the smbase value and switches off all percentage output types if it is less than the smbase value. Next, Quantum checks whether the current cell is a base cell and, if so, switches absolutes (op=1) back on. If the current cell is a mean Quantum switches absolutes off. If these tests result in no output types being set for the cell, Quantum prints a blank in the table when it reaches that cell. Otherwise it prints the remaining output types specified for the cell (absolutes or ranks, for example). The final check that Quantum makes is on the base or sum-of-n itself. If the base for a column is less than the smbase value, Quantum prints two asterisks to the right of that base value. If the sumof-n for a statistic is less than the smbase value, Quantum prints two asterisks to the right of the sum-of-n (or the blank if absolutes are switched off). If there is insufficient room to print the asterisks at the side of the column, Quantum prints them in the column instead. If there are any rows before the first base row, these tests are not applied since the information required by the tests is not available. Quantum prints footnotes on tables with small percentage suppression, explaining the meaning of the double asterisks: ** very small base (under nn): percents suppressed
If the table also contains T statistics and these cause the footnote: ** very small base (under nn) ineligible for sig testing
to be printed, Quantum suppresses the footnote about percentages.
198 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
Examples The examples in this section give you an idea of how smbase works in different situations. The first specification is: a;smbase=30;flush tab prefer region;op=1 tab prefer region;op=2 l region col 115;Base;North;South;East;West l prefer col 120;Base;Brand A;Brand B;Brand C;Brand D;Brand E
This creates two similar tables, one showing absolutes only and the other showing column percentages only. Percentages in the second table are suppressed if the base is less than 30.
Absolutes
Base Brand Brand Brand Brand Brand
A B C D E
Base 170 38 57 29 34 11
North 27 6 8 5 7 1
South 54 11 24 8 9 2
East 40 8 13 5 8 5
West 49 13 12 11 10 3
Col percents
Base Brand A Brand B Brand C Brand D Brand E ** very
Base North South East 170 27** 54 40 22.4% 20.4% 20.0% 33.5% 44.4% 32.5% 17.1% 14.8% 12.5% 20.0% 16.7% 20.0% 6.5% 3.7% 12.5% small base (under 30): percents suppressed
West 49 26.5% 24.5% 22.4% 20.4% 6.1%
The first table is flagged with op=1 only so the specification of smbase=30 on the a statement is ignored for this table. The second table has the same rows and columns but shows column percentages only. When Quantum processes the specification for this table it takes each cell in turn and compares the column base for that cell with 30. If the base is less than 30, Quantum suppresses all percentages for that cell. This is how the column percentages for North were suppressed. The asterisks next to the base of 27 indicate that it is a small base; the footnote explains this. Notice that it reports the value specified with smbase=. Creating tables – Chapter 7 / 199
Quantum User’s Guide Volume 2
The next specification has a mean element and a No answer element that does not contribute to the base: a;smbase=40;flush;nopc tab rating grid;op=2 l rating n10Base n01Brand A;col(a)=131 n01Brand B;col(a)=132 n01Brand C;col(a)=133 n01Brand D;col(a)=134 side col a00;Base;Excellent;%fac=5-1;Very Good;Good;Satisfactory;Poor n01No Answer;c=ca00n’1/5’;nofac n12Mean;dec=2
The table it creates is:
Col percents Base Brand A Brand B Brand C Brand D Base 181 34** 58 40 49 Excellent 21.0 19.0 20.0 26.5 Very Good 31.5 41.4 32.5 24.5 Good 16.0 13.8 12.5 22.4 Satisfactory 18.8 15.5 20.0 20.4 Poor 12.2 10.3 12.5 6.1 No Answer 0.6 0.0 2.5 0.0 Mean 3.31 ** 3.43 ** 3.45 ** very small base (under 40): percent suppressed
The main point to notice in this table is the difference between the columns for Brands A and C. The mean is suppressed in both columns and the cells are flagged with two asterisks indicating that suppression is because the numbers of respondents contributing to the means (in statistical terms, the sums-of-n) are less than 40. Looking at the base for Brand C you might not expect any percentages to be suppressed because the base is not less than the smbase value, but since the percentage for No Answer in this row is greater than zero you may assume that there is at least one person excluded from the mean. The sum-of-n is therefore less than the required value so the mean is suppressed. The column for Brand A has all the rating percentages suppressed because the base is less than 40. The mean is suppressed because the number of people contributing to it is less than 40.
200 / Creating tables – Chapter 7
Quantum User’s Guide Volume 2
The next specification requests a T-test on column proportions: a;smbase=40;flush tab brand region;op=12 l brand col 112;Base;Brand A;Brand B;Brand C;Brand D l region tstat prop;elms=ABCD;clevel=90 n10Base n01North;c=c111’1’;id=A n01South;c=c111’2’;id=B n01East;c=c111’3’;id=C n01West;c=c111’4’;id=D
The table is: Absolutes/col percents Base
North South East West (A) (B) (C) (D) Base 265 101 64* 72* 28** Brand A 43 6 24 13 0 16.2% 5.9% 37.5%AC 18.1%A Brand B 67 22 16 17 12 25.3% 21.8% 25.0% 23.6% Brand C 111 59 24 17 11 41.9% 58.5%BC 37.5%C 23.6% Brand D 44 14 0 25 5 16.6% 13.9%B 0.0% 34.7%AB ---------------------------------------Proportions: Columns Tested (10% risk level) - A/B/C/D * small base; ** Very small base (under 30) ineligible for sig testing
Figure 7.4 Table with small percentage suppression and T statistics The point to notice in this table is that the T statistic footnote about very small bases has overridden the one you would normally see showing small bases for percentages.
Creating tables – Chapter 7 / 201
Quantum User’s Guide Volume 2
Here is the same table run with the small base for T statistics set to 25. Notice the different footnote and the fact that column D is now included in the tests even though the percentages are suppressed: Absolutes/col percents Base
North South East West (A) (B) (C) (D) Base 265 101 64* 72* 28** Brand A 43 6 24 13 0 16.2% 5.9% 37.5%AC 18.1%AD Brand B 67 22 16 17 12 25.3% 21.8% 25.0% 23.6%ABC Brand C 111 59 24 17 11 41.9% 58.5%BCD 37.5%C 23.6% Brand D 44 14 0 25 5 16.6% 13.9%B 0.0% 34.7%AB B ---------------------------------------Proportions: Columns Tested (10% risk level) - A/B/C/D * small base ** Very small base (under 30) ineligible for sig testing
202 / Creating tables – Chapter 7
8 Table texts In this chapter we will discuss how to generate table titles and how to print page and table numbers for each table.
8.1 Table titles Quick Reference To define a table title, type: ttxtitle_text [][] where: x
defines the position of the title and is: •
l, r or c for left, right or centered justification
•
a number between 1 and 9 to indent the title by 10 times x spaces
•
g to line the text up with the start of the column headings
•
a or b to switch justification from left to right on alternate pages. tta prints on the left on the first, third, fifth and so on pages, while ttb prints on the left on the second, fourth, sixth and so on pages
title_text
is the title you want to print above the table.
is an optional keyword which allows you more control over the positioning of the table number. For more details, see section 8.5, ‘Table numbers’.
is an optional keyword which allows you more control over the positioning of the page number. For more details, see section 8.6, ‘Page numbers’.
Titles of any sort are created using tt statements at the appropriate place in the program. Their format is: ttx[Text] where x determines where on the line the text is to be printed: ttl
Left justified on the page.
ttr
Right justified on the page.
ttc
Centered within the page width.
Table texts – Chapter 8 / 203
Quantum User’s Guide Volume 2
ttn
Indented by ten times n spaces; for example, tt3 indents by 30 spaces.
tta
Left justified on the first, third, fifth pages, and so on, and right justified on the second, fourth, sixth pages, and so on.
ttb
The reverse of tta; that is right justified on the first, third and fifth pages, and left justified on the second, fourth and sixth pages.
ttg
Line up text with the first column allocated to the column headings. If you are using the standard row text width of 24 characters, ttg prints the first character of each table title in position 25 of each line. For example: a;flush;pagwid=57 tab age sex;op=12;decp=0;flush ttgBase: All Respondents 1 age ttgQ2: Age val c(110,111);Base;11-20 yrs;21-34 yrs;35-54 yrs;55+ yrs 1 sex col 109;Base;Male;Female
The table produced by this program would look like this: Page 1 Absolutes/total percents
Base 11-20 yrs 21-34 yrs 35-54 yrs 55+ yrs
Q2. Age Base: All Respondents Base Male 605 341 56% 120 73 20% 12% 290 161 48% 27% 146 81 24% 13% 49 26 8% 4%
Female 264 44% 47 8% 129 21% 65 11% 23 4%
Figure 8.1 Table titles printed with ttg You may type up to 200 characters on each tt statement. tt statements cannot be continued, but you can group any number of them together to form blocks of text. Text can be in upper or lower case, or both, and should be entered exactly as it is to be printed.
204 / Table texts – Chapter 8
Quantum User’s Guide Volume 2
Titles can be made to refer to different levels in the tabulation hierarchy: •
tts following the a statement define the run title which is printed at the top of each page.
•
tts after a flt statement refer to a group of tables, for example, a sub-report.
•
tts following a tab statement are relevant to that table only.
•
tts may also appear in an axis immediately after the l statement. These are printed whenever that axis is used for the rows in a table; they are ignored when the axis is used for the columns in a table.
☞ For further information on the flt statement, see section 9.1, ‘General filter statements’. Here is part of a typical tabulation program: a;side=20;spechar=-*;dsp;op=12 ttcProduct Awareness Test tab age sex ttlBase: All Respondents tab brand area ttlQ.5: Which brand did you try first? ttlBase: All Respondents
When there are titles from more than one level to be printed at the top of the table, you can decide what the printing order should be. The default printing order is: 1. tts following the a statement 2. Table number from tb statement 3. tts following row l statements 4. tts following tab statements 5. tts following flt statements 6. tts following flt= statements 7. tts starting with the word Base This order can be altered globally or for a group of tables or for an individual table using one of the options ttord=, ttbeg= or ttend= on the a, flt or tab statement.
☞ For further information on these options, see ‘Output options’ in chapter 2, ‘The hierarchy of the tabulation section’.
Table texts – Chapter 8 / 205
Quantum User’s Guide Volume 2
Titles for T statistics tables only Quick Reference To define a title that will be printed only on tables with special T statistics, type: ttxtitle_text;tstat
You may wish to specify titles that apply only to tables that contain T statistics. To do this define the title using a tt statement of your choice and append the keyword tstat to it. For example: a;dsp;clevel=90 ttcSouth East Local Electors’ Survey ttlConfidence level: 90%;tstat tab age sex tab prefer ban1 stat ntd;elms=ABCD
Here, the job title defined with ttc will be printed at the top of both tables, whereas the title that refers to confidence levels will be printed on the second table only. tstat is valid on tt statements at tab level and above. If an a, sectbeg, flt or tab statement is followed by more than one tt statement, only one of those statements may contain the tstat keyword.
✎ Quantum automatically prints a table footnote for each T statistic that is requested. ☞ For further information, see section 7.6, ‘Titles for tables with T statistics’ in the Quantum User’s Guide Volume 3.
206 / Table texts – Chapter 8
Quantum User’s Guide Volume 2
8.2 Underlining titles Quick Reference To underline a title, type: ttxtitle_text;unlnumber where number is 1 to underline the complete text, 2 to underline everything except blank strings, or 3 to underline non-blank characters only.
Titles can be underlined by appending the option unl to the end of the tt lines to be underlined. Unl must be separated from the rest of the text by a semicolon to stop it being printed as part of the title, and should be followed by a number indicating the type of underlining required. unl1
Underlines the whole line up to the last non-blank character.
unl2
As unl1, except that blank strings are not underlined.
unl3
Underlines non-blank characters only.
Here are some examples. The unl1 statement: ttlunderline
all
this;unl1
produces underline
all
this
The unl2 statement: ttldon’t underline
blank strings;unl2
produces don’t underline
blank strings
The unl3 statement: ttlunderline non-blanks only;unl3
produces underline non-blanks only
Table texts – Chapter 8 / 207
Quantum User’s Guide Volume 2
In some software packages underlining is achieved by inserting a line of hyphens or similar characters as a separate line underneath the text to be underlined. Quantum does not do this. Instead, it uses the underscore (_) character for underlining. As you can see, the underscore prints lower on the line than most other characters so if a line contains instructions to print a character and an underscore in the same position, the underscore will appear to underline the other character. Because of this, Quantum does not let you define a different underline character. If you want double underlining you must insert it as an extra text line in your titles or axes.
8.3 Printing text at the foot of a table Quick Reference To introduce titles to be printed after the last line of each page of the table, type: foot and then the text on tt statements.
Some tables require footnotes. These are defined using a foot statement followed by tt statements with the footnote required, for example: tab ax1 bk1 foot ttcAll figures rounded to the nearest whole number ttc- represents an absolute zero ttc* represents a value that rounds to zero
Footnotes are printed on the line immediately after the last line of figures in the table. To separate the footnote from the table, insert a few blank tts before the tts containing the text of the footnote, as shown below: foot tt2 tt2 tt2This footnote is preceded by two blank lines
Footnotes are printed on each page of a table spanning several pages. If you would prefer to have the text printed only on the last page of a long table, you could insert text-only statements (n03s) at the end of the table specification instead of using the foot statement. However, if you are sorting a table that uses n03s, make sure you specify the nosort keyword on these elements to force the text to be printed at the bottom of the table. You might also consider using the bot statement, described next, which prints the text at the bottom of each page of the table — rather than after the last line of figures of each page in the table. 208 / Table texts – Chapter 8
Quantum User’s Guide Volume 2
Foot and its tt statements may follow the a and flt statements to define a footnote globally or for a group of tables. To set up a footnote for one table only, put it after the tab statement for that table. Each level may define a footnote of up to 30 tt statements. If any line is underlined, it counts as two lines. Foot may also appear in an axis to introduce a footnote which is required whenever that axis is used. It must appear after the l statement, and after any tstat elements in the axis. An axis may contain a maximum of eleven tt statements altogether. When Quantum reads an l statement, it takes all titles to be titles for the top of the page until it reads a foot statement. Thereafter, titles are assumed to belong at the foot of the table until another foot is read. Once a footnote has been set up for a specific level, it remains operative until replaced by another footnote at the same level. Therefore to replace a footnote for a group of tables we would enter another flt statement followed by a foot and the tt statements with the new footer.
☞ For information on the flt statement, see section 9.1, ‘General filter statements’. When bottom or footer texts are defined at different stages of the run, the order of printing is determined by the ttord option, and unless you specify otherwise, axis-level texts will be printed before tab-level texts. To turn off a footer, just enter a foot statement followed by a blank tt statement, thus: flt foot ttlFootnote for a group of tables tab ax1 bk1 /*The next table has no footnote tab ax4 bk1 foot ttl /*Footnote still applies to this table tab ax5 bk2
Table texts – Chapter 8 / 209
Quantum User’s Guide Volume 2
8.4 Printing text at the bottom of a page Quick Reference To introduce titles to be printed at the bottom of each page of the table, type: bot and then the text on tt statements. Printing text at the bottom of a page is virtually the same as printing it at the foot of each page of a table, the only difference being that you use the foot statement instead of a bot statement. For example: bot tt1Print this text at the bottom of the page tt1and indent it by 10 spaces
At a, flt and tab level, bot may be followed by up to 30 tt statements (underlining counts as a separate line). Inside an axis, bot may be followed by up to eleven lines of text. Tables may have both foot and bot texts if you wish.
8.5 Table numbers Quick Reference To print table numbers, type: tbx [number] [;nand] where x determines the position of the table number on the line and is one of l for left justified, r for right justified, c for centered, or a or b for alternate justification. tba prints on the left on the first, third, and so on, pages, while tbb prints on the left on the second, fourth, and so on, pages. nand forces tables created by and statements to have the same table number as the parent tab statement. Alternatively, type: on a tt statement.
210 / Table texts – Chapter 8
Quantum User’s Guide Volume 2
Table numbers are not printed unless you request them either with a tb statement, or with the notation on a tt statement. The format of the tb statement is: tbl n
or
tbr n
or
tbc n
to have table numbers printed at the top left of the table, at the top right of the table, or centrally within the page width. In all three cases, n is the number the next table is to have. If tables are to be numbered consecutively from the given table number, only one tb statement is required. However, if some tables have non-consecutive numbers, the tab statements creating these tables must be preceded by a tb with the appropriate number: tbl tab tbl tab
5 brand region 9 tried region
You may need to do this when you are rerunning a selection of tables from a previous job. Table numbers may also be defined on tba and tbb statements so that their justification moves from left to right justification on alternate pages. If a title is defined on a tba statement, it will be printed left justified if it is on the first, third, fifth page, and so on, and right justified if it is in the second, fourth, sixth page, etc. If a title is defined on a ttb statement, the reverse will be true; that is right justification on first page, left justification on the second page, and so on. Tables generated by and statements are generally assigned individual table numbers even though they all come from the same statement. If you prefer, you may force all tables created by ands to have the same table number as the table on the tab statement. This option is invoked by the option nand on the tb statement: tbr 1;nand To switch off table numbering once it has been initiated, use the option notbl. To reset table numbering, simply enter another tb statement carrying the required table number as before. If you want more control over the positioning of the table number, switch off the automatic table numbering with notbl and define the table number on a tt statement, using the notation: to mark the position in which the table number is to be printed.
Table texts – Chapter 8 / 211
Quantum User’s Guide Volume 2
For example: tab age sex ttlTable : Age by Sex
When the table is created, Quantum will substitute the appropriate table number in place of . Since the title is defined on a ttl statement, the table number will be printed left-justified at the top of the table, together with any other titles from the axes. You may use this notation on tt statements at any position, either inside or outside the axis. Quantum numbers the tables sequentially from 1, as it does when you use tb. If you want to force a table to have a specific number, use a tb statement with the required number just before that table. Here’s an example to draw all these points together: a;dsp;op=12;notbl tba 1 tab age sex ttlTable : Age by Sex tab marry sex foot ttl ttl ttcTable : Marital Status by Sex tba 10 tab prefer region l region ttlTable : Regional breakdown
In this example, the first table is Table 1, and this text is printed at the top left corner of the page. The second table is Table 2. The title is printed at the foot of the table, separated from the last line of the table by two blank lines. The third table is Table 10. This text is printed at the top left corner of the page. Notice, that this title is defined as part of the row axis.
212 / Table texts – Chapter 8
Quantum User’s Guide Volume 2
8.6 Page numbers Quick Reference To define the page number to be printed on a page, type: pag number or type: on a tt statement.
Page numbers are always printed in the top right-hand corner of the table unless you use the option nopage on the a, flt or tab statement. The first page is Page 1, the second is Page 2, and so on. Note that page numbers are completely independent of table numbers: one table may cover several pages with different numbers, but the table number will remain the same. Page numbering is controlled by the pag statement which looks like this: pag n where n is the page number of the next table. As with tb, page numbers for various tables may be set individually by preceding the relevant tabs with a pag. Page numbering may be turned off for a single table by including the option nopage on the tab statement. To switch off page numbering for a group of tables, place nopage on a flt statement. When page numbers are switched off, Quantum does not stop incrementing the page count for each new page, it simply does not print the page number. Therefore, if we write: tab ax01 bk01 tab ax02 bk02;nopage tab ax01 bk03
The page number for the third table will be Page 3. If you want more control over the positioning of the page number, switch off the automatic page numbering with nopage and define the page number on a tt statement, using the notation: to mark the position in which the page number is to be printed.
Table texts – Chapter 8 / 213
Quantum User’s Guide Volume 2
For example: bot ttrPage tab age sex ttlTable : Age by Sex
When the table is created, Quantum will substitute the appropriate page number in place of . Since the page number is defined on a ttr statement under bot, it will be printed rightjustified at the bottom of the page. If you want to force a page to have a specific number, use a pag statement with the required number just before that table. Let’s expand the example we used above with tb by adding page numbers: a;dsp;op=12;notbl;nopage tba 1 pag 1 tab age sex ttlTable : Age by Sex bot ttrPage pag 5 tab marry sex foot ttl ttl ttcTable : Marital Status by Sex bot ttrPage tbl 10 tab prefer region bot ttrPage l region ttlTable : Regional breakdown
In this example, all tables have their page number in the lower right corner of the page. The first table starts on Page 1, the second starts on Page 5, and the third starts on Page 6 (assuming the previous table did not spread over more than one page).
214 / Table texts – Chapter 8
Quantum User’s Guide Volume 2
8.7 Controlling justification for individual tables Quick Reference To override the default justification of titles defined by the keywords tta, ttb, tba and tbb, use ori. Type: ori 0 to print text at the top of the current table in the same position as on the previous table, or: ori 1 to print it the opposite way round.
The ori statement determines the justification (page orientation) for text at the top of the table, and may be used to give finer control over the conditions imposed with tta, ttb, tba and tbb. If used, it must come before a tab statement. Its syntax is: ori n If n is 0 (zero), the text at the top of the current table will be printed in the same position as in the first table (that is, tta on the left and ttb on the right). If n is 1, the text will be printed the other way around (note that this may mean that two consecutive pages have the same orientation). For example: /*This is the first table on the first page /*Justification is L-R-L-R tba 1 tab age sex /*This table takes two pages - L and R ttaTable : Age by Sex /*This table takes one page - L tab marry age ttbTable : Marital Status by Age /*Orientation to match first page ori 0 /*This table takes two pages - L and R tab sex marry ttaTable : Sex by Marital Status
Table texts – Chapter 8 / 215
Quantum User’s Guide Volume 2
The first table will have its table number and title left justified on the first page and right justified on the second.The second table will have its table number and title left justified. Because it is preceded by ori 0, the third table will have its table number and title left justified on the first page and right justified on the second. Without ori, the third table would have right justification on the first page (the 4th page overall) and left justification on the second page (the 5th page overall).
216 / Table texts – Chapter 8
9 Filtering groups of tables Filter statements are the second level in the tabulation hierarchy. They define conditions, options and text applicable to the tables on all subsequent tabs until another filter is defined. There are two types of filter: general (flt) and named (flt=).
9.1 General filter statements Quick Reference To define filters and options for a group of tables, type: flt[;c=logical_expression][;options]
The flt statement provides conditions, options and text for the group of tab statements which follow it, and should be placed immediately before the first tab to which it refers. The filters and options remain operative until another flt statement is read or until overridden by different options for a single table. The flt statement has the format: flt[;filters and options] where filters and options are any of the keywords mentioned as valid on the tab statement in section 7.2, ‘Options on the tab statement’. Each option in the list must be separated by a semicolon. For example, the statement: flt;c=c106’2’;nz;decp=2
causes: •
All subsequent tables to be filtered to include women only (c=c106’2’).
•
All rows in which all cells are zero to be omitted.
•
All percentages to be shown to two decimal places.
Conditions (c=) defined on a flt statement are additional to those defined later on the individual tabs, whereas options apply to all tables unless overridden by a different version of themselves on the tabs.
Filtering groups of tables – Chapter 9 / 217
Quantum User’s Guide Volume 2
If we write: flt;c=c106’2’ tab occup region;c=c132’1’ ttlBase: Women in Full Time Employment
we are creating an ‘and’ condition for our table: c=c106’2’.and.c132’1’
which will include all women who have full-time employment. On the other hand, if the flt defines a global scaling factor of 10 and an individual tab has a scaling factor of 5, the cells in all tables except the one with scale=5 will be multiplied by ten before they are printed. Cells in the other table will be multiplied by five.
✎ In hierarchical data it is an error to specify inc= on flt statement without an anlev option being in force. However, an anlev option on the a statement will carry forward to the flt.
☞ For further information about hierarchical (levels) data, see chapter 3, ‘Dealing with hierarchical data’ in the Quantum User’s Guide Volume 3.
General filter statements may have and and tt statements associated with them, the former listing higher dimension axes to be used in all tables in the group, while the latter defines the text to be printed at the top of all tables, in addition to texts generated by the tab statement. For instance: flt;c=c106’2’;nz;decp=2 and3 region tab age occup tab class age tab occup class
will produce three 3-dimensional tables: Region by Age by Occupation Region by Class by Age Region by Occupation by Class all of which will only include women. Flts may also be followed by foot and bot statements, each with tt statements defining other texts relevant to the group of tables as a whole. Flt is useful when groups of tables have the same overall filters, or where a set of tables are to be produced more than once using different filters.
218 / Filtering groups of tables – Chapter 9
Quantum User’s Guide Volume 2
For example: flt;c106’1’;op=12 ttcMen tab ax01 demo;c=c121’1’ ttcResident in Central London tab ax01 demo;c=c121’2’ ttcResident in Outer London tab ax01 demo;c=c121’3’ ttcResident in England Outside London flt;c=c106’2’;op=12 ttcWomen tab ax01 demo;c=c121’1’ ttcResident in Central London
In this case we are tabbing the same set of axes for men and women separately. If we did not want such specific table titles (i.e., showing the region), we could have written this example more simply by generating a 3-dimensional table with region as the third dimension, thus: flt;c=c106’1’;op=12 ttcMen tab region ax01 demo . Other tables . flt;c=c106’2’;op=12 ttcWomen tab region ax01 demo . .
Yet another way of cutting down on the amount of writing is to make this a 4-dimensional table: tab sex region ax01 demo;op=12
As you can see, there are many ways of tackling this. Which one you choose depends on what other tables you have to produce and the type of output requested by the client. To cancel a filter altogether, rather than replacing it with another one, just enter a blank flt. Note that this will cancel not only the conditions and options on the previous filter, but also any tt texts or and statements associated with it.
Filtering groups of tables – Chapter 9 / 219
Quantum User’s Guide Volume 2
9.2 Named filters Quick Reference To define a set of filter conditions and options that you may refer to by name, type: flt=name[;c=logical_expression][;options]
Named Filters are very useful ways of increasing the efficiency of, and reducing work in, a program where sets of tables, each with its own flt statement and text, are interspersed. As described above, conditions, options and text are defined using filter statements, but this time we give the filter a name. The syntax is: flt=name;filters and options where name is a name of up to 15 characters, and filters and options are as described for general filters above. This may then be followed by tt statements describing the filter. For instance: flt=male;c=c106’1’;op=120 ttlMales
defines a filter to include men only. To use a named filter, simply add the option flt=name to each tab statement requiring the filter. The statement: tab ax01 demo;flt=male
produces a table of ax01 by demo filtered by C106’1’, using the heading males. When filters are applied in this way, they refer only to the table on which they are named. Note also that a named filter on a tab does not override any previous general flts whose conditions apply to that table. The conditions are additive in this case. For example, if we have a series of tables consisting of one table each for men, women and all respondents, followed by another set for the same three groups, and for one reason or another we cannot rearrange them and use general filters or use 3-dimensional tables, we can greatly reduce our work by creating three named filters and applying each one in turn to the tab statements which create the sets of tables for men, women and all respondents.
220 / Filtering groups of tables – Chapter 9
Quantum User’s Guide Volume 2
We might write: flt=male;c=c106’1’;op=012 flt=fem;c=c106’2’;op=012 flt=all;c=c106’12’;op=012 tab ax01 demo;flt=male tab ax01 demo;flt=fem tab ax01 demo;flt=all
9.3 Nested filter sections in table specs Quick Reference To mark the start of a nested filter section, type: sectbeg[; c=logical_expression] [;options] To mark the end of a nested filter section, type: sectend
Sometimes, you’ll have a group of tables which share the same overall set of titles and filters, but some tables within the group will require additional titles and filters. If you use flt statements, you’ll define the filters and titles for the first group and then repeat them, with the additional titles, for the second group. A more efficient method is to write a nested table spec. In a nested table spec, you define your tables in groups or sections. The outermost group has filters and titles which apply to all tables in that group and also to any table subgroups which may occur in the group. Inner groups have just their additional filters and titles defined in their specs, but when Quantum creates the tables it will take the filters and titles for the outer group(s) first and then apply the additional filters and titles required for the subgroup. As an example, suppose you have a set of tables for people who bought a new car during the last six months. You then want a second group of tables for women who bought a new VW car during that period. The basic titles and filters are the same — bought a new car during the last six months — but there are extra titles and filters for the second set of tables, namely, women who bought VWs. Therefore, you have two sections for filtering. The top level or section is people who bought new cars during the last six months, the lower level or subsection is the women who bought VWs.
Filtering groups of tables – Chapter 9 / 221
Quantum User’s Guide Volume 2
The statements associated with this facility are sectbeg and sectend. To start a section, type: sectbeg; options where options is any of the options permitted on a, flt and tab statements, except dp and netsort. To end a section, type: sectend You may use up to ten sectbeg statements before using a sectend, but you must be certain that you include one sectend for every sectbeg used. The use of consecutive sectbeg statements without an intervening sectend signals a subsection within the main section. This ends at the first sectend, leaving the main section to continue until another sectend (with no further sectbeg statements) is read.
✎ You cannot use a flt statement within a nested filter section; that is, between the sectbeg and sectend statements.
Having defined your filter requirements with sectbeg, you then enter titles and tab statements as usual. Here’s the spec for our new car buyers: /* Force table titles to be printed last a;op=12;dsp;ttend=tab ttc J.1234: 1991 Car Buyers Study /* General tables with no filters or subsections tab age sex tab make region /* Start of new car buyers section sectbeg; c=c123’1’ .and. month .le. 6 ttlBought a new car in the last six months tab make region tab reason ban1 tab problems make /* Start of subsection for female VW buyers sectbeg; c=c109’2’ .and. c130’5’ ttlWomen who bought a new VW tab reason ban1 ttlReason for buying VW tab likes ban1 ttlWhat likes about car tab dislikes ban1 ttlWhat dislikes about car /* End of subsection for female VW buyers sectend /* End of new car buyers section sectend
222 / Filtering groups of tables – Chapter 9
Quantum User’s Guide Volume 2
The comments in the spec explain where each section starts and ends. When Quantum reaches the second sectbeg statement, it knows that it hasn’t yet read a sectend statement to terminate the first section, so it assumes that this is the start of a table subsection. Any filters or options on the second sectbeg plus any titles defined after it are applied to the tables in that section in addition to filters and titles already in place for the main section. The table of likes by ban1 will have four titles: J.1234: 1991 Car Bought a new car Women who bought What likes about
Buyers Study in the last six months a new VW car
We used the option ttend=tab on the a statement to force Quantum to print titles in this order rather than printing filter titles after table titles. If you wanted to write the same spec using flt statements, you’d need one flt statement for each sectbeg, containing the full filter specification for the next set of tables, followed by a listing of all titles required for those tables. For the tables in the subsections, this would mean repeating titles which you’d already defined for previous tables.
Filtering groups of tables – Chapter 9 / 223
10 Include and substitution This chapter tells you how you can increase the efficiency of your program by filing frequentlyused groups of statements separately and calling them up as and when they are required. A facility exists to allow parts of Quantum programs to be filed and included at the appropriate position in the main Quantum program. Entire blocks of axes and table control statements may be filed and later retrieved whenever called for. It is quite possible, and indeed common, to have a whole run consisting of a series of files to be included. An additional bonus is that Quantum allows you to replace variable items in the file with symbolic parameters, and to define the values these parameters are to have each time the file is retrieved.
10.1 Filing and retrieving statements Quick Reference To include one data file in another, or to include a file of Quantum statements in the main program file, type: #include file_name *include is an alternative to #include
Programs may be split up into logical units, for example, edit, tabs, and axes, with each group of statements saved in a different file. A program is most likely to contain groups of identical statements when a series of tables is reproduced a number of times using different filters. Say, for example, that we are asked to produce a series of tabulations by area of residence, and for each area we require the tables: tab brand demo ttcBrand Bought Most Often tab prefer age ttcBrand Preferred tab demo bk01 ttcDemographic
Include and substitution – Chapter 10 / 225
Quantum User’s Guide Volume 2
This could be done using a flt statement for every area and writing out these statements five times, thus: flt;c=c121’1’ ttlBase: Respondents Living in Central London tab brand demo ttcBrand Bought Most Often . .
but we can reduce our work greatly by creating a new file containing the tabs and tts instead. Let’s call it tab1. Now, to create these tables we need to tell Quantum to read the file. This is done with an *include or #include line in the program at the point at which the file should be read. (There is no difference between *include and #include, but we’ll stick to #include for all our examples.) For example: flt;c=c121’1’ ttlBase: Respondents living in Central London #include tab1 flt;c=c121’2’ ttlBase: Respondents Living in Outer London #include tab1 flt;c=c121’3’ ttlBase: Respondents Living in England Outside London #include tab1 . .
This example may be abbreviated even further by using symbolic parameters for the items which differ from filter to filter. This is discussed below. Because tab1 is in the same directory as the rest of our program we have only entered its filename. If the include file is in a different directory or partition, you need to give its full name. It is an error if a specified file does not exist, and Quantum generates a message saying it is unable to find the file. Quantum also generates an error message if there is any other problem such as ‘permission denied’. The first time a file is included, Quantum lists its contents in the output listing, but whenever it is included again in the same program, only the include statement is printed so that you can see which file Quantum has read in. An include file may itself include other files: for example, the file called subs may include the contents of a file called ax9A. Each time we call up subs we are also calling up ax9A. This is called nesting. 226 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
The statement #include filename may appear in a Quantum data file as well. Includes may be nested in a data file to four levels: that is, the main data file may contain an include statement to call up the file DATAB, which itself includes DATAC which in turn includes DATAD: Main data file | #include DATAB | #include DATAC | #include DATAD
10.2 Filing and retrieving non-identical statements Sometimes a Quantum program contains a set of statements which are similar but not identical. Quantum allows the set to be filed with symbolic parameters for the varying parts. You may then define the actual values of these parameters each time the include file is called. Symbolic parameters are frequently used when you have a series of questions all having the same response list, with the only difference being the columns or codes with which the answers are coded. You can either write out the axes specifications separately with a different column number each time, or you can put the axis into an include file and replace the column number and/or code with symbolic parameters. You can then call up the file as many times as necessary, defining a new value for the symbolic parameter each time. When parameters are defined for files included in this way, the parameter value refers only to statements within that file. Statements in the main file need their own symbolic parameters and definitions. Global definitions may be assigned to parameters using the #def statement.
☞ For further information about the #def statement, see section 10.3, ‘Assigning global values to symbolic parameters’.
Include and substitution – Chapter 10 / 227
Quantum User’s Guide Volume 2
Symbolic parameters for columns Quick Reference To define a column symbolic parameter, type: col(letter)=column_number To use a column symbolic parameter, type: cletter number where number is any integer number.
Symbolic parameters for columns are written in the form: cann where: •
a is any single upper- or lower-case letter, except C, N, T, U, X or any other letter that is the name of a user-defined variable. Do not use C, T and X because they are the names of Quantum variables; for example, it is an error to write ct10 because Quantum will think you mean c(t10) to substitute the value of t10. The letters N and U are invalid because they represent the operators ‘not equal to’ and ‘unequal to’; for example, it is an error to write cU30 because Quantum will think you are trying to check whether the value in a column field is unequal to 30, but have omitted the column numbers. Similarly, do not use the same letter for a symbolic parameter as that used for the name of a user-defined variable. This is particularly important if the variable was defined with the s option, because Quantum will not recognize the letter as a symbolic parameter and will use the value of the variable instead.
•
nn is any integer number.
If we choose the symbolic parameter ‘b’, in the file ifil, we might have: n01Prefer Product A;c=cb00’1’ n01Prefer Product B;c=cb00’2’
b00 is the symbolic parameter which will be replaced by the appropriate column number each time ifil is used. This is done with the notation: col(b)=n on the #include statement. b is the name of the symbolic parameter and n is the value to be substituted.
228 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
For instance: #include ifil;col(b)=256
Now, when the contents of ifil are read, the column numbers will be interpreted as: n01Prefer Product A;c=c256’1’ n01Prefer Product B;c=c256’2’
Remember that the value of 256 for column b00 is relevant only to the statements within ifil. Any statements in the main file using column b00 will need separate definitions for this column. Let’s take a practical example. Our respondents were given two detergents marked A and B to try. After two weeks they were interviewed and asked to say which product they preferred for a variety of tasks. Our client wants a table showing which product was preferred for each task. The questionnaire tells us that each task is coded into a different column, but the codes defining which product was preferred remain the same throughout: a ‘2’ in c134 indicates that Product A was preferred for washing woolens, while the same code in c135 means that Product A was preferred for washing cottons. To make this example clearer, here is the relevant part of the questionnaire: No Task
Diff
Noticed a Difference Pref A
Pref B
Only
A
B
No Pref
Used 1
Only
Only
Woolens
1
2
3
4
5
6
7
(c134)
Cottons
1
2
3
4
5
6
7
(c135)
The row texts and the codes are the same for each product, the only thing that changes is the column, therefore we can replace it with a symbolic parameter and file the statements away in a file called ipref, as follows: n01Noticed a Difference;c=ca00’2/4’ n01 Prefer Product A;c=ca00’2’ n01 Prefer Product B;c=ca00’3’ n01 No Preference;c=ca00’4’ n01Did Not Notice a Difference;c=ca00’1’ n01Only Used One Product (DK Which);c=ca00’5’ n01Only Used Product A;c=ca00’6’ n01Only Used Product B;c=ca00’7’
Include and substitution – Chapter 10 / 229
Quantum User’s Guide Volume 2
In our axis we would write: l prefer n10Base n23Washing Woollens;unl1 #include ipref;col(a)=134 n23Washing Cottons;unl1 #include ipref;col(a)=135 n23Washing By Hand;unl1 #include ipref;col(a)=136 . .
Note that when you define a value for a symbolic parameter, it always refers to the parameter numbered 00. Whenever Quantum reads a00 from ipref, it will substitute 134, 135 or 136 in its place, as defined on the #include statement. If the notation were a06 instead, Quantum would replace it with 140 (or 141 or 142), since a06 is six more than a00. In our next example, we have a series of unaided questions asking respondents to name products they are aware of and then to say for which products they have seen or heard advertising. For each question we record the first response separately from any others. We want to set up two axes, one for first mentioned in brand awareness (aware1) and the other for first mentioned in advertising awareness (aware2). Each brand in each of the two categories is coded into a separate column. If the column contains a ‘1’, the product was mentioned first, if it contains a ‘2’, the product was not named first. The questionnaire looks like this: Aware of Existence First Other ----------------------------Brand A 1 2 (124) Brand B 1 2 (125) Brand C 1 2 (126)
Aware of Advertising First Other ----------------------------Brand A 1 2 (148) Brand B 1 2 (149) Brand C 1 2 (150)
Both axes use the same brand list, so in our program file we would simply write: l aware1 #include blist;col(a)=124 l aware2 #include blist;col(a)=148
230 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
The rows of the axis would be defined in blist as: n10Base n01Brand A;c=ca00’12’ n01Brand B;c=ca01’12’ n01Brand C;c=ca02’12’
Notice that the number of the symbolic parameter is increased by 1 for each brand, because each brand has its own column. In aware1, Brand A is in c124, Brand B is in c125, Brand C is in c126, and so on, whereas when we call up blist for aware2, Brand A is read from c148, Brand B from c149, and so on. More than one symbolic parameter of the same sort may be used on a line, as long as the names of the parameters are different. Suppose we wanted to set up an include file for rows which show whether a respondent mentioned a brand first for both questions. The condition is an ‘and’ condition requiring two columns to be named. We can either use the same symbolic parameter and remember to increment the second by the difference in column numbers between the two questions: n01Brand A;c=ca00’1’.and.ca24’1’
or we can use two different parameters and have each start from 00: n01Brand A;c=ca00’1’.and.cb00’1’
The #include statement for the latter would be: #include bfil1;col(a)=124;col(b)=148
In all our examples we have used n01 statements. Symbolic parameters may also be used on col and val statements: col a00;Base;Brand A;Brand B; ...
☞ For examples of using column symbolic parameters, see section 10.4, ‘Grid tables’.
Include and substitution – Chapter 10 / 231
Quantum User’s Guide Volume 2
Symbolic parameters for codes Quick Reference To define a symbolic parameter for codes, type: punch(letter)=’code’ To use a code symbolic parameter, type: var_name’letter’ where letter is the name of the symbolic parameter.
Codes are assigned symbolic parameters in much the same way as columns, except that the notation is: cn’a’ where n is any whole number and ’a’ is any single letter in uppercase or lowercase. We might have a set of questions asking which brands of cat food were bought on various visits to the shops. Each brand has a different code, but all information about any one visit is stored in the same column. However, we need to set up axes based on the brand bought rather than the visit when it was bought. Thus we might have an axis as follows: l brda n10Base n01First Visit;c=c134’1’ n01Second Visit;c=c137’1’ n01Third Visit;c=c140’1’ n01Fourth Visit;c=c143’1’
The axes for the other three brands are exactly the same except that codes 2, 3 and 4 are used instead of a ‘1’. Therefore it makes sense to use an include file: n10Base n01First Visit;c=c134’p’ n01Second Visit;c=c137’p’ n01Third Visit;c=c140’p’ n01Fourth Visit;c=c143’p’
232 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
and include it as follows: l brda #include brds;punch(p)=’1’ l brdb #include brds;punch(p)=’2’
For each run, you may use up to 31 different symbolic parameters for codes (including blanks). Also, all definitions are only relevant to the statements within the include file. If you type any additional characters inside the quotes, Quantum converts the letter to its corresponding codes and does not perform the substitution you require.
✎ If your code substitution appears not to be working, check that you have not accidentally typed an extra character with the symbolic parameter inside the quotes. Quantum only performs the substitution if the symbolic parameter is the only code inside the quotes. If there is any other code inside the single quotes with the symbolic parameter, Quantum treats the symbolic parameter as a multicode. For example, if you type: 1 ax1 #include brds;punch(p)=’1’
and brds contains the following line: n01Brand A;c=c132’5p’
Quantum will treat the ‘p’ as a multicode of ‘7–&’ and will include in the element any record in which column 132 contains any of the codes 5, 7, – or &. Without the ‘5’, the specification would refer only to records with a code 1 in c132.
Include and substitution – Chapter 10 / 233
Quantum User’s Guide Volume 2
Symbolic parameters for text Quick Reference To define a symbolic parameter for text, type: name=text To use a text symbolic parameter, type: &name
Texts are replaced by one or more characters preceded by an ampersand. For example: ttl&txt n23All Traveling by &txt
Names used for symbolic text parameters must not contain blanks. If more than one symbolic text parameter is used in a program, their names must be unique amongst the lowest number of characters. That means, if there are two symbols, one of three characters and one of four, the first three characters of each symbol must differ by at least one character. However, if both symbols are the same length, only the last character need differ for them to be unique. For example: •
SYM and SYM1
•
SYM1
are not unique, but
and SYM2 are unique
Now that we know this, we can write the example used in the earlier section, ‘Symbolic parameters for columns’, even more efficiently, since we can use a symbolic parameter for the texts as well. Instead of writing out the heading on the n23 statement we can represent it with the parameter ‘wash’: n23&wash;unl1 n03 n01Noticed a Difference;c=ca00’3/5’ n01 Prefer Product A;c=ca00’3’ n01 Prefer Product B;c=ca00’4’ n01 No Preference;c=ca00’5’ n01Did Not Notice a Difference;c=ca00’2’ n01Only Used One Product (DK Which);c=ca00’6’ n01Only Used Product A;c=ca00’7’ n01Only Used Product B;c=ca00’8’
and define it on the #include line like this: #include ipref;col(a)=134;wash=Washing Woollens
234 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
As you can see, the text itself may be longer than the parameter which represents it. Just make sure, though, that when the text is substituted, it does not make the whole line longer than the 200 character maximum allowed. We can also rewrite the example in section 10.1, ‘Filing and retrieving statements’. In tab1 we write: flt;c=c121’p’ ttlBase: Respondents Living in &area tab brand demo ttcBrand Bought Most Often tab prefer age ttcBrand Preferred tab demo bk01 ttcDemographics
and in our program we enter: #include tab1;punch(p)=’1’;area=Central London #include tab1;punch(p)=’2’;area=Outer London
Once again, the definitions for the symbolic parameters refer to the statements in the file included, but not to the rest of the program.
✎ The default maximum number of different text symbol parameters per run is 15, but as one of these is always used internally, the usable number is 14.
☞ For details on how to increase this parameter, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
Symbolic parameters for variables Users are sometimes misled by the col(a) notation into thinking that it is only for substitutions to do with columns. This is not true. You can use col(a) to define symbolic parameters for variables too. To illustrate this, let’s go back to the product test we used for explaining symbolic parameters for columns. In the example that dealt with product and advertizing awareness we explained how you could use two symbolic parameters on the same line to test whether a product was named first at both the existence and the advertizing questions. To do this you could either use the same parameter with different values: n01Brand A;c=ca00’1’ .and. ca24’1’
or you could use two different parameters: n01Brand A;c=ca00’1’ .and. cb00’1’
Include and substitution – Chapter 10 / 235
Quantum User’s Guide Volume 2
An alternative is to create an array of named variables in the edit section that are set to 1 if the respondent mentions the same brand first at both questions. You can then replace the ‘and’ condition on each element with a reference to one variable containing all the information you need. The program you’ll write is: int first 3s ed t2 = 0 do 10 t1 = 124,126 t2 = t2+1 first(t2) = c(t1)’1’ .and. c(t1+24)’1’ 10 continue end tab faware bk01 l faware ttlSame brand mentioned first for existence and advertising #include bfil1;col(a)=1
The include file, bfil1, contains the elements of the axis as follows: n01Brand A;c=first(a00).eq.1 n01Brand B;c=first(a01).eq.1 n01Brand C;c=first(a02).eq.1
At the end of the edit first(1) will be set to 1 if the respondent mentioned Brand A first at both the existence and advertising questions. It will be set to zero if Brand A was mentioned first at one question only or was not mentioned at all. first(2) and first(3) contain similar information for brands B and C respectively.
☞ For further information about do loops, see section 9.5, ‘Loops’ in the Quantum User’s Guide Volume 1.
236 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
10.3 Assigning global values to symbolic parameters Quick Reference To assign global values to symbolic parameters, type: #def [col(letter1)=number1] [;punch(letter2)=’code’] [;name=text] where number1 is a two-digit number in the range 00 to 99. *def is an alternative to #def.
Occasionally a group of includes will have the same column, code or text parameter in common, even though they may differ in all other aspects. You may either enter all values separately on each include, in which case they refer only to the parameters in the file included, or you may save yourself time by defining the common parameter values on a #def statement so they will remain operative until overwritten by another #def. The format of #def is: #def [col(a)=cc][;punch(b)=’p’][;txt=text] where: •
col, punch and txt are optional, depending on the value to be defined.
•
a and b are the parameters whose values are to be defined.
•
cc is a column number.
•
p is a code.
•
text is a string of text.
#def also has an equivalent *def which you may use if you prefer. We’ll use #def in our examples. For example, to define a column that is common to a group of include files, we might write: #def col(b)=157
In ‘Symbolic parameters for text’, we rewrote an example first introduced earlier in this chapter, to show how you can use symbolic text to write more efficient code. Let’s continue that example and suppose that we have a number of include files for each area of London: #include #include #include #include #include #include
tab1;punch(p)=’1’;area=Central London tab2;punch(p)=’1’;area=Central London tab3;punch(p)=’1’;area=Central London tab1;punch(p)=’2’;area=Outer London tab2;punch(p)=’2’;area=Outer London tab3;punch(p)=’2’;area=Outer London
Include and substitution – Chapter 10 / 237
Quantum User’s Guide Volume 2
By using #def, we can rewrite this more efficiently: #def punch(p)=’1’;area=Central London #include tab1 #include tab2 #include tab3 #def punch(p)=’2’;area=Outer London #include tab1 #include tab2 #include tab3
10.4 Grid tables Grid tables are a special sort of table whose specification invariably uses symbolic parameters. Normally, as in all the tables we have discussed so far, the condition determining whether or not a respondent is eligible for inclusion in a cell is the same for all cells in a given row. In the axis sex, for instance, all men are included in the first row and all women in the second. There is usually one condition for all cells in a given column as well. With grid tables, the conditions for a row or column vary from cell to cell, so we use symbolic parameters to refer to the data columns and/or codes for each cell. Values are then assigned to these parameters via n01 statements in the axis. Grid tables are easily recognizable in a questionnaire because in many cases the questionnaire contains a chart on which the interviewer is to record the responses, with the rows of the chart being the rows required on the table, and the columns being the same as the columns required in the table. In your output you will want to reproduce this chart with the only difference being that on the questionnaire you see the codes representing each answer whereas on your table you will see the number of people giving each response. Typical questions are ones dealing with rating scales.
Grid axes Grid tables come from grid axes which comprise four items: 1. The l statement which names the axis and defines its conditions. 2. n01 statements to define the column headings and assign values to the symbolic parameters. 3. The side statement to separate the column definitions from the row specifications. 4. n, col, val or fld statements to define the row elements. Statistical and totalling elements may also be used in grid axes.
238 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
✎ When you tabulate a grid axis, you need to use the grid keyword on the tab statement. ☞ For further information, see ‘Cross-tabulating grid axes’, later in this section. Let’s work through an example, starting with the chart on the questionnaire. There are four products to be rated on a scale of 1 (Excellent) to 5 (Very poor); in the questionnaire we see: (c134) Brand A
(c135) Brand B
(c136) Brand C
(c137) Brand D
Excellent
1
1
1
1
Very Good
2
2
2
2
Satisfactory
3
3
3
3
Poor
4
4
4
4
Very poor
5
5
5
5
The interviewer circles one code for each brand. Before deciding how to write this in Quantum, let’s look at the conditions for each cell of this table and consider how they differ from those in an ordinary table. In a normal table the axes used for the rows and columns are independent of each other. In this grid table the condition for the row depends on the condition for the columns, and vice versa. Then, following the instructions laid out for grid axes, we write: l q10 n01Brand A;col(a)=134 n01Brand B;col(a)=135 n01Brand C;col(a)=136 n01Brand D;col(a)=137 side col a00;Base;Excellent;Very Good;Satisfactory;Poor;Very poor
The texts on the first four n01s provide us with the column headings and the values to be assigned to the symbolic parameter for each column. If we had wanted to lay out the column headings in a particular way, we could have written them on g statements immediately before the side line. The col statement names the symbolic parameter to be used and lists the row texts required. Since no codes have been defined it is assumed that the first response is code ‘1’, the second is a ‘2’, and so on. This axis produces the table shown above, except that the numbers 1 to 5 in each column are replaced by counts of respondents giving each rating.
Include and substitution – Chapter 10 / 239
Quantum User’s Guide Volume 2
Suppose, now, that each rating is coded into a different column, so that Brand A is always a ‘1’, Brand B is always a ‘2’ and a rating of Satisfactory for Brand C would be c136’2’. The grid on the questionnaire is: (c134) Excellent
(c135) Very Good
(c136) Satisfactory
(c137) Poor
(c137) Very poor
Brand A
1
1
1
1
1
Brand B
2
2
2
2
2
Brand C
3
3
3
3
3
Brand D
4
4
4
4
4
Nevertheless, we still want to create the same table as before, with brands as columns. This time we would write: l q11 n01Brand A;punch(p)=’1’ n01Brand B;punch(p)=’2’ n01Brand C;punch(p)=’3’ n01Brand D;punch(p)=’4’ side ttlQ11: Overall Brand Rating ttlBase: All Respondents n01Excellent;c=c134’p’ n01Very Good;c=c135’p’ n01Satisfactory;c=c136’p’ n01Poor;c=c137’p’ n01Very poor;c=c138’p’
By comparing these two examples we can see when to use symbolic parameters for columns in a grid axis, and when to use them for codes. In the first example, the column numbers differed from column to column of the table, so we defined them with column symbolic parameters; in the second, the codes differed between columns, so we defined them with code symbolic parameters. In short, look at the columns of the table to see what alters and define the changing item with parameters. In more complicated tables it is possible that both columns and codes will change from column to column, especially if the grid refers only to specific elements of a response list. Once again let’s work through an example to explain this. In a survey on washing powders respondents have been questioned to test their awareness of various brands on the market and to check what sort of advertising they have seen or heard for various brands. The company who commissioned the survey is now interested in finding out more about peoples’ attitudes to their particular products. They ask for a table showing the number of
240 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
people who have already purchased one of their products and also how likely people would be to buy them. c(212,213) tell us whether the respondent buys the product, c(317,320) contain the number of times each brand was bought, and c(321,324) show how likely the respondent will be to buy the brand in the future. Here is the axis which will produce the required table — we will discuss it presently: l q20 n01Washo;col(a)=317;col(b)=212;punch(p)=’6’ n01Suds;col(a)=318;col(b)=212;punch(p)=’7’ n01Gleam;col(a)=319;col(b)=213;punch(p)=’3’ n01Sparkle;col(a)=320;col(b)=213;punch(p)=’5’ side ttlQ20 – Number of Times Purchased ttlQ21 – Purchase Intent n00;c=cb00’p’ n10Base – All Who Purchased Product col a00;hd=Number of Times Purchased;%unl1;One;Two; +Three-Four;Five-Six;Seven-Ten;More Than Ten;dk=rej n00 col a04;hd=Purchase Intent;%unl1;Base=All Respondents; +Definitely Will Buy;Probably Will Buy;Might or Might Not Buy; +Probably Will Not Buy;Definitely Will Not Buy;DK/NA/Refused
Let’s start by looking at the row definitions after side. The first n statement is an n00 — a filter — which sets up the base for the number of people buying each of the products. It uses both column and code symbolic parameters which are defined on the column n01s above. The filter for all buying Washo is c212’6’, while all buying Sparkle are collected with c213’5’. The first col statement reads each of columns 317 to 320 to see how many times the respondent bought each of the four products. If c317’3’ it means that the respondent bought Washo three or four times; a ‘6’ in c320 tells us that he or she bought Sparkle more than ten times. The blank n00 switches off the condition on the first n00 and all respondents now become eligible for inclusion in the rest of the table. This time we re-use one of our symbolic parameters and increment it by four for each brand. The second col statement therefore reads data from columns 321 for Washo, 322 for Suds, 323 for Gleam and 324 for Sparkle. If c322’4’ we know that the respondent probably will not buy Gleam. The second part of this example (from the blank n00 onwards) assumes that respondents were only asked about purchase intent if they said they were aware of the product and that no other respondent has a code in these columns. If this was not the case, we would put a condition on the n00 to exclude anyone who was not aware of one of the key brands. (The table which this axis creates is shown overleaf.) Even though this example looks complicated, it is by no means uncommon. Its main attraction is that it enables you to produce a grid table from several questions giving the maximum amount of input in the minimum number of statements.
Include and substitution – Chapter 10 / 241
Page
242
Absolutes/col percents Q20 - Number of Times purchased Q21 - Purchase Intent
Base: All Who Purchased Product
Washo
Suds
Gleam
Sparkle
130
150
110
180
Number of Times Purchased One
6 5%
12 8%
26 24%
20 11%
Two
23 18%
3 2%
11 10%
30 17%
Three-Four
12 9%
34 23%
5 5%
26 14%
Five-Six
17 13%
39 26%
9 8%
51 28%
Seven-Ten
15 12%
28 19%
23 21%
16 9%
More Than Ten
42 32%
25 17%
23 21%
20 11%
DK
15 12%
9 6%
13 12%
17 9%
Purchase Intent All Respondents
200
208
215
211
Definitely Will Buy
31 16%
21 10%
20 9%
33 16%
Probably Will Buy
29 15%
59 28%
47 22%
42 20%
Might or Might Not Buy
57 29%
43 21%
56 26%
61 29%
Probably Will Not Buy
54 27%
43 21%
49 23%
35 17%
Definitely Will Not Buy
26 13%
36 17%
43 20%
40 19%
3 2%
6 3%
0 0%
0 0%
DK/NA/Refused
Figure 10.1 Grid table
Quantum User’s Guide Volume 2
#def with grids You do not use #def with grids themselves, but there may be times when your job contains #def statements and grids. When this happens, you need to be particularly careful about the letters you use for symbolic parameters. If you use the same letters for symbolic parameters on a #def statement as in a grid axis you will find that either your job will fail at the compile stage or it will produce incorrect tables. •
If you use the same letter for a column symbolic parameter on #def and in a grid axis, the specification from #def overrides the specification in the grid. If the two parameters refer to different columns your grid table will contain incorrect data for that column. For example, if you specify #def col(a)=145 and then write n01text;col(a)=167 in the grid axis, Quantum will create the element using column 145.
•
With punch(p)=, the specification from #def does not carry forward to grid axes. If you specify punch(p) on #def but not in a grid axis your run will fail at the compile stage with the message ‘grid axis with no substitution’, even if #def declares the punch letter you have used in the grid. This also happens if you specify punch(p) with #def and in a grid axis, and you use the same letter to represent the punch, since Quantum ignores the specification in the grid. With punches you must use different letters in the grid and on #def.
•
Although grids do not normally use text symbolic parameters, if a grid contains the notation &txt, where txt is declared on a #def statement, substitution will take place. For example, specifying #def txt=Brand A and then writing n01&txt in a grid axis will generate an element in the grid labeled Brand A.
Options in grid axes All options valid on n statements may be used in grid axes, with the exception of rej=. Incs in grid axes can be specified in two ways. The first is to use the standard notation, for example: inc=c(a00,a01)
The second is to define it with a number, and then to call it up using that number. On the column n01 statement the column whose contents are to be used as the increment is identified with the option: inc(n)=arithmetic_expression where n is a whole number. Then, it is called up on an n25 as follows: n25;inc=inc(n)
Include and substitution – Chapter 10 / 243
Quantum User’s Guide Volume 2
To illustrate this, we will go back to our rating question discussed at the beginning of the ‘Grid axes’ section earlier in this chapter. Respondents have been asked to rate four products on a scale of 1 (Excellent) to 5 (Very poor), and we want to calculate a mean score. The axis we would write to do this is as follows: l rates n01Brand A;col(a)=134;inc(1)=c134 n01Brand B;col(a)=135;inc(1)=c135 n01Brand C;col(a)=136;inc(1)=c136 n01Brand D;col(a)=137;inc(1)=c137 side col a00;Base;Excellent;Very Good;Satisfactory;Poor;Very poor n25;inc=inc(1) n12Mean Score
Cross-tabulating grid axes Quick Reference To create a table from a grid axis, type: tab axis_name grid [;options] to create rows and columns as they appear in the axis definition, or: tab axis_name rgrid [;options] to rotate it by 90 degrees, so the row definitions become the columns, and the column definitions become the rows).
Grid tables are the only time that the tab statement may be followed by a single axis name only. To produce a table in which the rows and columns are as defined in the grid axis, type: tab axis_name grid [;options] where axis_name is the name of the grid axis and grid is a keyword indicating that this is a grid table. Since this is so, it follows that you cannot have an axis called grid. Options may be any of the keywords listed in ‘Options on a, sectbeg, flt and tab statements’ in chapter 2, ‘The hierarchy of the tabulation section’ or in section 7.2, ‘Options on the tab statement’.
244 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
Normally, a grid table is created using the row and column definitions as they appear in the axis. However, you may rotate the table by 90 degrees so that the rows in the axis form the columns of the table, and the columns in the axis form the rows of the table. The keyword which requests this type of table is rgrid: tab axis_name rgrid [;options] The axis: l rating n01Brand A;col(a)=134 n01Brand B;col(a)=135 n01Brand C;col(a)=136 n01Brand D;col(a)=137 side col a00;Base;Excellent;Very Good;Satisfactory;Poor;Very poor
tabulated in the normal way with grid produces a table with brands as the columns and ratings as the rows. With rgrid it generates a table in which the ratings are the columns and the brands are the rows. If there are no g and p statements in the lower section of the axis, the column headings will be generated in automatic mode. Note that any options defined with op= on the a or flt statement will be applied to the table whether or not it is rotated. If you have op=12 (absolutes and column percentages) specified on the a/flt statement, and you want to use the same axis with grid and rgrid, you must specify the correct output options for the rgrid table if horizontal percentages and absolutes are required. For example: a;dsp;op=12 tab rating grid tab rating rgrid;op=01
Grid axes in levels jobs Grid axes in levels jobs work exactly the same as grid axes in ordinary jobs. To create a table at one level and update its cells at a lower level, define the table creation level with anlev= on both the tab and l statement. Define the update level with uplev= on the l statement. For example: tab gax1 grid;anlev=person l gax1;anlev=person;uplev=shop n01Safeway;col(a)=208 n01Tesco;col(a)=209 n01Co-op;col(a)=210 side col ca00;Base;Banana;Strawberry;Peach;Pineapple
Include and substitution – Chapter 10 / 245
Quantum User’s Guide Volume 2
This table is created at person level and updated at shop level. It tells you how many people bought each flavor of yogurt in each shop. You can create the same table using anlev= and celllev= on the tab statement and anlev= by itself on the l statement: tab gax1 grid;anlev=shop;celllev=person l gax1;anlev=shop n01Safeway;col(a)=208 n01Tesco;col(a)=209 n01Co-op;col(a)=210 side col ca00;Base;Banana;Strawberry;Peach;Pineapple
This table is created at shop level, but its cells are updated once per person after all data for that person has been read.
Weighted grids Grid tables can be weighted. Normally, they’ll be part of a weighted run and the weighting characteristics will be defined using ordinary axes such as age, sex or region. If you need to define a weighting matrix specifically for a grid you must do so using a dummy axis since Quantum does not accept grid axes on wm statements. The dummy axis must have the same number of elements as there are cells in the grid axis. You can create it simply by using a col statement that refers to a blank column. For example, if the grid axis is: l rating n01Brand A;col(a)=134 n01Brand B;col(a)=135 side col a00;Base;Excellent;Satisfactory;Very bad
you would define the dummy axis as: l dumgrid col 90;1;2;3;4;5;6
You then create a weighting matrix for the grid but instead of using the name of the grid axis on the wm statement you use the name of the dummy axis: wm9 dumgrid;factor;1.25;1.16;1.30;0.98;1,01;0.92
To weight the grid, name the matrix on the tab statement as you would for any other table: tab rating grid;wm=9
246 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
When the table is created, respondents who rated brand A as excellent will be given a weight of 1.25, respondents who weighted brand A as satisfactory will be given a weight of 1.16, and so on.
10.5 Filtered columns in grid tables The specification for the sample table uses n00 statements in the side section of the axis to define additional filters for groups of row elements. Columns in grid axes may be filtered using c= as you do in ordinary axes. The example below is of a product test in which filtering of columns is quite common. In our survey respondents are asked to test two products, A and B. One group tests them in the order A then B, while the other tries B then A, but neither group knows which product is which. When respondents are asked about these products, they are simply referred to as ‘the product tried first’ or ‘the product tried second’. The interviewer answers the question about the order in which the products were tried. Let’s look at two sample questions and their responses: Q3 Order in which products tried A then B ....... 1 (C123) B then A ....... 2 Q9 Likelihood of buying each product First product tried: (C146) Second product tried: (C147) Definitely buy it ...... 1 Definitely buy it ....... 1 Probably buy it ........ 2 Probably buy it ......... 2 Might/might not buy it . 3 Might/might not buy it .. 3 Probably not buy it .... 4 Probably not buy it ..... 4 Definitely not buy it .. 5 Definitely not buy it ... 5
Suppose the client wants a table to show how likely people would be to buy each product, and whether this varies according to the order in which the products were tried.
Include and substitution – Chapter 10 / 247
Quantum User’s Guide Volume 2
The grid axis for the table is: l gax01 n01A;col(a)=146;c=c123’1’ n01B;col(a)=147;c=c123’1’ n01A;col(a)=147;c=c123’2’ n01B;col(a)=146;c=c123’2’ g Tried A First Tried B First g A B A B g------- ------------- ------p x x x x side ttlQ9. Purchase Intent col a00;Base;Definitely would buy;Probably would buy; +Might or might not buy;Probably would not buy; +Definitely would not buy
The finished table is shown in Figure 10.2.
Table 10 Q9. Purchase Intent
absolutes/col percents Tried A First A B ------- -------
Base Definitely would buy Probably would buy Might or might not buy Probably would not buy Definitely would not buy
150 16 11% 32 21% 44 29% 27 18% 31 21%
150 10 7% 14 9% 36 24% 50 33% 40 27%
Tried B First A B ------- ------| | | | | | | | | | |
180 12 7% 29 16% 53 29% 50 28% 36 20%
180 21 12% 49 27% 67 37% 25 14% 18 10%
Figure 10.2 Filtered columns in grid tables The first cell of the leftmost column contains people who have the condition c123’1’.and.c146’1’ — that is, people who tried brand A first and who would definitely buy it. The bottom cell of the right-most column will contain respondents who satisfy the condition c=c123’2’.and.c146’5’ — that is, those who tried brand B first and would definitely not buy it.
248 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
10.6 Exporting grid axes in Quanvert Quick Reference If you want Quanvert to export a grid axis to SPSS or SAS on a row-by-row basis rather than a column-by-column basis, place the keyword: byrows on the l statement for that axis. This keyword has no effect on the Quantum tables. When a Quanvert user exports a grid axis in SAS or SPSS format, Quanvert exports it on a columnby-column basis so that each cell of each column becomes a separate SAS or SPSS variable. For example, if the grid axis is defined in Quantum as: l rating1 n01Brand A;col(a)=123 n01Brand B;col(a)=124 n01Brand C;col(a)=125 side col a00;Base;Excellent;Very good;Satisfactory;Poor
Quanvert creates one SAS or SPSS variable per brand. However, if the grid is specified as: l rating2 n01Excellent;punch(p)=’1’ n01Very good;punch(p)=’2’ n01Satisfactory;punch(p)=’3’ n01Poor;punch(p)=’4’ side n10Base n01Brand A;c=c123’p’ n01Brand B;c=c124’p’ n01Brand C;c=c125’p’
each variable would contain data from more than one column of the data (it would be multicoded) so Quanvert creates one variable for each cell of the column instead. In this example the SAS and SPSS data will contain one variable for each combination of brand and rating, for example, Brand A Excellent, Brand A Very good, and so on. With this example, it is not a problem to write the grid in the first format so that the SAS and SPSS data contains one variable per brand which is usually what is required. However, not all grids are as simple, so Quantum allows database administrators to flag grid axes that need to be exported in Quanvert on a row-by-row basis rather than in the standard column-by-column way. The keyword that does this is byrows and it is used on the l statement. It has no effect in Quantum.
Include and substitution – Chapter 10 / 249
Quantum User’s Guide Volume 2
Using the examples shown here, if you did not wish to rewrite the rating2 axis as it was shown in the example called rating1, you could simply add byrows to the l statement of rating2 to achieve the same set of SAS and SPSS variables in Quanvert: l rating2;byrows n01Excellent;punch(p)=’1’ n01Very good;punch(p)=’2’ n01Satisfactory;punch(p)=’3’ n01Poor;punch(p)=’4’ side n10Base n01Brand A;c=c123’p’ n01Brand B;c=c124’p’ n01Brand C;c=c125’p’
Reading non-standard data files Quick Reference To read a non-standard data file into Quantum, create a dummy data file containing the statement: #includes file_name;reclen=num_cols[;header=number[r]] where header is the number of characters (number) or records (numberr) to skip at the start of the file.
Quantum is able to read certain types of non-standard data file. Facilities currently exist for: •
Skipping unwanted data at the start of a file.
•
Reading records which are not terminated by a new-line character; for example, where the data is a continuous string of characters in which each record is exactly a given length.
To read a non-standard data file, create a dummy data file containing the line: #includes datafile;reclen=n[;header=n[r]] where datafile is the name of the non-standard data file, and reclen defines the length of each record in bytes (characters).
250 / Include and substitution – Chapter 10
Quantum User’s Guide Volume 2
The header parameter is required when there is information at the start of the file which you wish to ignore. If you enter it as ‘header=n’, it indicates that n bytes (characters) should be skipped at the start of the file; if you enter it as ‘header=nr’, it indicates that n complete records should be skipped, where a record is assumed to be reclen bytes long. Quantum reads the data file in binary, and ignores any values in the skipped header. Any nonprintable characters in the rest of the data are converted to blanks (these are values other than 32-127 inclusive).
Include and substitution – Chapter 10 / 251
11 A sample Quantum job /* define data structure struct;read=2;ser=c(6,8);crd=c9 ed /* For people leaving museum, gather things they saw into one place if (c104’2’) c181=or(c139,c141,c143,c145,c147,c149,c151,c153,c155, ++c157,c159,c161,c163,c165,c167,c169) if (c104’2’) c182=or(c140,c142,c144,c146,c148,c150,c152,c154,c156, ++c158,c160,c162,c164,c166,c168,c170) end /* define default options for tables a;dsp;flush;decp=0;spechar=–*;op=12;pagwid=120;nz;side=20 ttcVISITOR SURVEY - BRITISH MUSEUM (NATURAL HISTORY) /* define tables to include everybody tab age sex tab q7 ban1 tab q12 ban1 und q13 ban1 /* define tables for those leaving museum only flt;c=c104’2’ ttlBase: All Leaving Museum tab lq1 ban1 und lq2 ban1 tab lq3 ban1 tab lq7 ban1 tab lq8 ban1 und lq9 ban1 /* define axes l sex ttlQ1. Sex ttlBase: All Respondents col 110;Base;Male;Female /* l age ttlQ2. Age ttlBase: All Respondents col 111;Base;11-16 yrs;17-20 yrs;21-24 yrs;25-34 yrs;35-44 yrs; +45-54 yrs;55-64 yrs;65+ yrs /*
A sample Quantum job – Chapter 11 / 253
Quantum User’s Guide Volume 2
l q7 ttlQ7. Have you visited Museum before? ttlQ8. If so, number of previous visits excluding this one ttlBase: All Respondents col 116;Base;Yes;No n00;c=c116’1’ n11Base n23All visiting Museum previously val c(117,118);=;0 times;1 time;2 times;3 times;4 times;5 times; +6 times;7 times;8 times;9 times;10 times;i;11+ times=11-99 n01DK/NA;c=/* l q12 ttlQ12. Have you visited any other museum/art gallery before today ttl and/or do you intend to visit any others? ttlBase: All Respondents col 123;Base;Yes;No;DK/NA=rej /* l q13;c=c123’1’ ttlQ13. Museums/Art galleries visited/intend to visit ttlBase: All who visited other museums before today ttl and/or intend to visit others n11Base col 124;hd=All visited/intending to visit other museums; +Science Museum;Victoria and Albert;IGS;British Museum; +Tate Gallery;National Gallery;Others;DK/NA=rej /* l lq1 ttlQ1. How long have you been in the Museum today? col 137;Base;A few minutes;Half hour;Three-quarters of an hour; +One hour;One and half hours;Two hours;Two and half hours; +Three hours;Three and half hours;4 hours/half a day;Whole day; +DK/NA=rej /* l lq2 ttlQ2. Was your stay longer/shorter than intended? col 138;Base;Longer;Shorter;Hadn’t planned particular length of time; +About what I’d planned;DK/NA=rej /* l lq3 ttlQ3. What do you remember seeing? n10Base col 181;Human Biology;Man’s place in evolution;Wildlife in danger; col 182;Dinosaurs;Collections/Conservation/Research;Fish and reptiles; +Fossil galleries;Birds;Insects;Whale hall;Mammals;Minerals/meteorites; +Introducing ecology;Botany;Origin of species
254 / A sample Quantum job – Chapter 11
Quantum User’s Guide Volume 2
n01Others;c=c181’4’ n01DK/NA;c=/* l lq7 ttlQ7. How did you find your way round the Museum? col 232;Base;Signposting;Guidebook;Attendant;Wandered; +Brief description of route taken;"With difficulty"; +Gallery plan;With someone who knew/already knew;DK/NA=rej /* l lq8 ttlQ8. Could signposting be improved? col 233;Base;Yes;No;Don’t know;Other;DK/NA=rej /* l lq9;c=c233’1’ ttl Q9. How do you think it might be improved? ttlBase: All who think signposting could be improved col 234;Base;Increase frequency;Larger/clearer;Color; +Device to indicate section;Specific problem/solution; +Non specific comment;Comment about something other than signing; /* define banners l ban1 n10TOTAL col 110;Male;Female col 111;11-20=’12’;21-34=’34’;35-54=’5/6’;55+=’78’ col 112;Yes;No col 116;Yes;No g g g Sex Age g -----------------------------------g TOTAL Male Female 11-20 21-34 35-54 55+ g ----------------------------------------------------p x x x | x x x x | g Completed Visited g Full Time Museum g Education Before g -------------------g Yes No Yes No g-----------------------------p x x | x x
The tables produced by this program are shown on the following pages.
A sample Quantum job – Chapter 11 / 255
Page 256 VISITOR SURVEY - BRITISH MUSEUM (NATURAL HISTORY) Absolutes/col percents Q2. Age Base: All Respondents
Base
Base
Male
Female
605
341
264
11-16 yrs
38 6%
23 7%
15 6%
17-20 yrs
82 14%
50 15%
32 12%
21-24 yrs
98 16%
52 15%
44 17%
25-34 yrs
194 32%
109 32%
85 32%
35-44 yrs
91 15%
49 14%
42 16%
45-54 yrs
55 9%
32 9%
23 9%
55-64 yrs
33 5%
16 5%
17 6%
65+ yrs
16 3%
10 3%
6 2%
Figure 11.1 Tables produced by the sample Quantum job
Page 257 VISITOR SURVEY - BRITISH MUSEUM (NATURAL HISTORY) Absolutes/col percents Q7. Have you visited the Museum before? Q8. If so, number of previous visits excluding this one? Base: All Respondents Completed Visited Full Time Museum Sex Age Education Before --------------------------------------------------------TOTAL Male Female 11-20 21-34 35-54 55+ Yes No Yes No ---------------------------------------------------------------------------------------Base 605 341 264 | 120 290 146 49 | 480 135 | 306 299 | | | Yes 306 177 129 | 70 136 76 24 | 245 61 | 306 51% 52% 49% | 58% 47% 52% 49% | 51% 49% | 100% | | | No 299 164 135 | 50 154 70 25 | 235 64 | 299 49% 48% 51% | 42% 53% 48% 51% | 49% 51% | 100% | | | All visiting Museum previously | | | 1 time 88 52 36 | 17 44 24 3 | 77 11 | 88 29% 29% 28% | 24% 32% 32% 13% | 31% 18% | 29% | | | 2 times 56 29 27 | 19 24 10 3 | 41 15 | 56 18% 16% 21% | 27% 18% 13% 13% | 17% 25% | 18% | | | 3 times 33 14 19 | 9 12 8 4 | 26 7 | 33 11% 8% 15% | 13% 9% 11% 17% | 11% 11% | 11% | | | 4 times 22 14 8 | 6 9 7 | 15 7 | 22 7% 8% 6% | 9% 7% 9% | 6% 11% | 7% | | | 5 times 14 7 7 | 4 7 3 | 10 4 | 14 5% 4% 5% | 6% 5% 5% | 4% 7% | 5% | | | 6 times 21 15 6 | 15 4 2 | 20 1 | 21 7% 8% 5% | 11% 5% 8% | 8% 2% | 7% | | | 7 times 5 5 | 2 3 | 4 1 | 5 2% 3% | 3% 2% | 2% 2% | 2% | | | 8 times 3 3 | 2 1 | 3 | 3 1% 3% | 3% 1% | 1% | 1% | | | 9 times 1 1 | 1 | 1 | 1 * 1% | 1% | * | * | | | 10 times 12 5 7 | 4 6 2 | 6 6 | 12 4% 3% 5% | 6% 4% 3% | 2% 18% | 4% | | | 11 times 51 33 18 | 7 15 17 12 | 42 9 | 51 17% 19% 14% | 10% 11% 22% 50% | 17% 15% | 17% | | |
Figure 11.1 (Continued) Tables produced by the sample Quantum job
Page 258 VISITOR SURVEY - BRITISH MUSEUM (NATURAL HISTORY) Absolutes/col percents Q12. Have you visited any other museum/art gallery before today and/or do you intend to visit any other? Base: All Respondents Q13. Museum/Art galleries visited/intend to visit? Base: All who visited other museums before today and/or intend to visit other Completed Visited Full Time Museum Sex Age Education Before --------------------------------------------------------TOTAL Male Female 11-20 21-34 35-54 55+ Yes No Yes No ---------------------------------------------------------------------------------------Base 605 341 264 | 120 290 146 49 | 480 135 | 306 299 | | | Yes 427 256 171 | 92 207 97 31 | 339 88 | 222 205 71% 75% 65% | 77% 71% 66% 63% | 71% 70% | 73% 69% | | | No 178 88 93 | 28 83 49 18 | 141 37 | 84 94 29% 25% 35% | 23% 29% 34% 37% | 29% 30% | 27% 31% | | | All visited/intending to visit other museums | | | Science Museum 334 210 124 | 74 158 81 21 | 268 66 | 172 162 78% 82% 73% | 80% 76% 84% 68% | 79% 75% | 77% 79% | | | Victoria and Albert 92 49 43 | 20 35 27 10 | 76 16 | 46 46 22% 19% 25% | 22% 17% 28% 32% | 22% 18% | 21% 22% | | | IGS 47 31 16 | 11 22 8 6 | 35 12 | 21 26 11% 12% 9% | 12% 11% 8% 19% | 10% 14% | 9% 13% | | | British Museum 26 18 8 | 8 11 6 1 | 17 9 | 11 15 6% 7% 5% | 9% 5% 6% 3% | 5% 10% | 5% 7% | | | Tate Gallery 19 7 12 | 6 9 4 | 12 7 | 9 10 4% 3% 7% | 7% 4% 4% | 4% 8% | 4% 5% | | | National Gallery 21 11 10 | 4 10 5 2 | 15 6 | 10 11 5% 4% 6% | 4% 5% 5% 6% | 4% 7% | 5% 5% | | | Others 37 16 21 | 10 17 7 3 | 39 8 | 18 19 9% 6% 12% | 11% 8% 7% 10% | 9% 9% | 8% 9% | | |
Figure 11.1 (Continued) Tables produced by the sample Quantum job
Page 259 VISITOR SURVEY - BRITISH MUSEUM (NATURAL HISTORY) Absolutes/col percents Q1. How long have you been in the Museum today? Q2. Was your stay longer/shorter than intended? Base: All Leaving Museum
Base A few minutes Half hour Three-quarters of an hour One hour One and half hours Two hours Two and half hours Three hours Three and half hours 4 hours/half a day Whole day Base Longer Shorter
Completed Visited Full Time Museum Sex Age Education Before --------------------------------------------------------TOTAL Male Female 11-20 21-34 35-54 55+ Yes No Yes No ---------------------------------------------------------------------------------------301 171 130 | 57 152 71 21 | 237 64 | 156 145 | | | 7 5 2 | 1 4 2 | 5 2 | 6 1 2% 3% 2% | 2% 3% 3% | 2% 3% | 4% 1% | | | 35 26 9 | 4 19 6 4 | 29 6 | 18 17 12% 15% 7% | 11% 13% 8% 19% | 12% 9% | 12% 12% | | | 27 18 9 | 4 12 8 3 | 23 4 | 17 10 9% 11% 7% | 7% 8% 11% 14% | 10% 6% | 11% 7% | | | 61 35 26 | 17 24 17 3 | 45 16 | 28 33 20% 20% 20% | 30% 16% 24% 14% | 19% 25% | 18% 23% | | | 64 36 28 | 13 36 11 4 | 49 15 | 35 29 21% 21% 22% | 23% 24% 15% 19% | 21% 23% | 22% 20 | | | 50 22 28 | 8 25 13 4 | 42 8 | 24 26 17% 13% 22% | 14% 16% 18% 19% | 18% 13% | 15% 18% | | | 21 8 13 | 2 14 5 | 17 4 | 8 13 7% 5% 10% | 4% 9% 7% | 7% 6% | 5% 9% | | | 13 8 5 | 3 5 4 1 | 9 4 | 8 5 4% 5% 4% | 5% 3% 6% 5% | 4% 6% | 5% 3% | | | 2 2 | 1 1 | 1 1 | 2 1% 1% | 2% 1% | * 2% | 1% | | | 11 5 5 | 1 5 3 2 | 9 2 | 7 4 4% 3% 5% | 2% 3% 4% 10% | 4% 3% | 4% 3% | | | 10 6 4 | 1 7 2 | 8 2 | 3 7 3% 4% 3% | 2% 5% 3% | 3% 3% | 2% 5% | | | 301 171 130 | 57 152 71 21 | 237 64 | 156 145 | | | 49 25 24 | 13 26 8 2 | 33 16 | 19 30 16% 15% 18% | 23% 17% 11% 10% | 14% 25% | 12% 21% | | | 91 59 32 | 13 48 21 9 | 78 13 | 49 42 30% 35% 25% | 23% 32% 30% 43% | 33% 20% | 31% 29% | | |
Figure 11.1 (Continued) Tables produced by the sample Quantum job
Page 260 VISITOR SURVEY - BRITISH MUSEUM (NATURAL HISTORY) Absolutes/col percents Q1. How long have you been in the Museum today? Q2. Was your stay longer/shorter than intended? Base: All Leaving Museum
Base Hadn’t planned particular length of time About what I’d planned DK/NA
Completed Visited Full Time Museum Sex Age Education Before --------------------------------------------------------TOTAL Male Female 11-20 21-34 35-54 55+ Yes No Yes No ---------------------------------------------------------------------------------------301 171 130 | 57 152 71 21 | 237 64 | 156 145 | | | 84 44 40 | 19 43 19 3 | 64 20 | 39 45 28% 26% 31% | 33% 28% 27% 14% | 27% 31% | 25% 31% | | | | | | 74 42 32 | 11 34 22 7 | 60 14 | 46 28 25% 25% 25% | 19% 22% 31% 33% | 25% 22% | 29% 19% | | | 3 1 2 | 1 1 1 | 2 1 | 3 1% 1% 2% | 2% 1% 1% | 1% 2% | 2% | | |
Figure 11.1 (Continued) Tables produced by the sample Quantum job
Page 261 VISITOR SURVEY - BRITISH MUSEUM (NATURAL HISTORY) Absolutes/col percents Q1. What do you remember seeing? Base: All Leaving Museum
Base Human Biology Man’s place in evolution Wildlife in danger Dinosaurs Collections/ Conservation/Research Fish and reptiles Fossil galleries Birds Insects Whale Hall Mammals Minerals/meteorites Introducing ecology
Completed Visited Full Time Museum Sex Age Education Before --------------------------------------------------------TOTAL Male Female 11-20 21-34 35-54 55+ Yes No Yes No ---------------------------------------------------------------------------------------301 171 130 | 57 152 71 21 | 237 64 | 156 145 | | | 123 60 63 | 23 71 25 4 | 98 25 | 65 58 41% 35% 48% | 40% 47% 35% 19% | 41% 39% | 42% 40% | | | 120 62 58 | 28 62 21 9 | 90 30 | 51 69 40% 36% 45% | 49% 41% 30% 43% | 38% 47% | 33% 48% | | | 32 17 15 | 2 25 4 1 | 29 3 | 19 13 11% 10% 12% | 4% 16% 6% 5% | 12% 5% | 12% 9% | | | 259 152 107 | 53 130 58 18 | 203 56 | 128 131 86% 89% 82% | 93% 86% 82% 86% | 86% 88% | 82% 90% | | | 58 38 20 | 11 28 15 4 | 49 9 | 35 23 19% 22% 15% | 19% 18% 21% 19% | 21% 14% | 22% 16% | | | 111 77 34 | 25 52 27 7 | 90 21 | 56 55 37% 45% 26% | 44% 34% 38% 33% | 38% 33% | 36% 38% | | | 64 35 29 | 6 40 15 3 | 53 11 | 30 34 21% 20% 22% | 11% 26% 21% 14% | 22% 17% | 19% 23% | | | 100 52 48 | 19 59 16 6 | 84 16 | 50 50 33% 30% 37% | 33% 39% 23% 29% | 35% 25% | 32% 34% | | | 75 41 34 | 18 41 12 4 | 61 14 | 39 36 25% 24% 26% | 32% 27% 17% 19% | 26% 22% | 25% 25% | | | 83 43 40 | 14 49 15 5 | 72 11 | 43 40 28% 25% 31% | 25% 32% 21% 24% | 30% 17% | 28% 28% | | | 142 64 78 | 31 69 31 11 | 111 31 | 67 75 47% 37% 60% | 54% 45% 44% 52% | 47% 48% | 43% 52% | | | 88 40 48 | 19 44 19 6 | 70 18 | 31 57 29% 23% 37% | 33% 29% 27% 29% | 30% 28% | 20% 39% | | | 29 14 15 | 4 22 3 | 23 6 | 14 15 10% 8% 12% | 7% 14% 4% | 10% 9% | 9% 10% | | |
Figure 11.1 (Continued) Tables produced by the sample Quantum job
Page 262 VISITOR SURVEY - BRITISH MUSEUM (NATURAL HISTORY) Absolutes/col percents Q1. What do you remember seeing? Base: All Leaving Museum
Base Botany Origin of species Others
Completed Visited Full Time Museum Sex Age Education Before --------------------------------------------------------TOTAL Male Female 11-20 21-34 35-54 55+ Yes No Yes No ---------------------------------------------------------------------------------------301 171 130 | 57 152 71 21 | 237 64 | 156 145 | | | 58 31 27 | 12 33 10 3 | 45 13 | 26 32 19% 18% 21% | 21% 22% 14% 14% | 19% 20% | 17% 22% | | | 101 52 49 | 24 51 19 7 | 74 27 | 51 50 34% 39% 38% | 42% 34% 27% 33% | 31% 42% | 33% 34% | | | 82 51 31 | 14 42 18 8 | 61 21 | 46 36 27% 30% 24% | 25% 28% 25% 38% | 26% 33% | 29% 25% | | |
Figure 11.1 (Continued) Tables produced by the sample Quantum job
VISITOR SURVEY - BRITISH MUSEUM (NATURAL HISTORY)
Page 263 Absolutes/col percents
Q7. How did you find your way around the Museum? Base: All Leaving Museum
Base Signposting Guidebook Attendant Wandered Brief description of route taken "With difficulty" Gallery plan With someone who knew/ already knew DK/NA
Completed Visited Full Time Museum Sex Age Education Before --------------------------------------------------------TOTAL Male Female 11-20 21-34 35-54 55+ Yes No Yes No ---------------------------------------------------------------------------------------301 171 130 | 57 152 71 21 | 237 64 | 156 145 | | | 127 71 56 | 19 66 31 11 | 104 23 | 59 68 42% 42% 43% | 33% 43% 44% 52% | 44% 36% | 38% 47% | | | 22 6 16 | 2 14 4 2 | 20 2 | 9 13 7% 4% 12% | 4% 9% 6% 10% | 8% 3% | 6% 9% | | | 11 3 8 | 2 3 5 1 | 8 3 | 10 1 4% 2% 6% | 4% 2% 7% 5% | 3% 5% | 6% 1% | | | 120 76 44 | 28 58 25 9 | 93 27 | 52 68 40% 44% 34% | 49% 38% 35% 43% | 39% 42% | 33% 47% | | | 4 2 2 | 1 1 1 1 | 3 1 | 2 2 1% 1% 2% | 2% 1% 1% 5% | 1% 2% | 1% 1% | | | 16 10 6 | 3 7 5 1 | 12 4 | 11 5 5% 6% 5% | 5% 5% 7% 5% | 5% 6% | 7% 3% | | | 35 23 12 | 7 20 8 | 26 9 | 21 14 12% 13% 9% | 12% 13% 11% | 11% 14% | 13% 10% | | | 30 14 16 | 7 13 8 2 | 23 7 | 28 2 10% 8% 12% | 12% 9% 11% 10% | 10% 11% | 18% 1% | | | 3 2 1 | 3 | 3 | 1 2 27% 30% 24% | 2% | 1% | 1% 1% | | |
Figure 11.1 (Continued) Tables produced by the sample Quantum job
Page 264 VISITOR SURVEY - BRITISH MUSEUM (NATURAL HISTORY) Absolutes/col percents Q8. Could signposting be improved? Q9, How do you think it might be improved? Base: All who think signposting could be improved Base: All Leaving Museum
Base Yes No Don’t know DK/NA Base Increase frequency Larger/clearer Color Device to indicate selection Specific problem/ solution Non specific comment Comment about something other then signing
Completed Visited Full Time Museum Sex Age Education Before --------------------------------------------------------TOTAL Male Female 11-20 21-34 35-54 55+ Yes No Yes No ---------------------------------------------------------------------------------------301 171 130 | 57 152 71 21 | 237 64 | 156 145 | | | 95 51 44 | 21 48 23 3 | 75 20 | 64 31 32% 30% 34% | 37% 32% 32% 14% | 32% 31% | 41% 21% | | | 176 103 73 | 30 87 42 17 | 137 39 | 77 99 58% 60% 56% | 53% 57% 59% 81% | 58% 61% | 49% 68% | | | 27 15 12 | 6 14 6 1 | 22 5 | 14 13 9% 9% 9% | 11% 9% 8% 5% | 9% 8% | 9% 9% | | | 3 2 1 | 3 | 3 | 1 2 1% 1% 1% | 2% | 1% | 1% 1% | | | 95 51 44 | 21 48 23 3 | 75 20 | 64 31 | | | 15 8 7 | 7 6 2 | 8 7 | 11 4 16% 16% 16% | 33% 13% 9% | 11% 35% | 17% 13% | | | 30 15 15 | 5 14 11 | 24 6 | 23 7 32% 29% 34% | 24% 29% 48% | 32% 30% | 36% 23% | | | 11 7 4 | 4 4 3 | 6 5 | 11 12% 14% 9% | 19% 8% 13% | 8% 25% | 17% | | | 2 2 | 1 1 | 3 | 1 1 2% 5% | 2% 4% | 3% | 2% 3% | | | 32 18 14 | 3 18 9 2 | 28 4 | 20 12 34% 35% 32% | 14% 38% 39% 67% | 37% 20% | 31% 39% | | | 4 2 2 | 1 3 | 4 | 3 1 4% 4% 5% | 5% 6% | 5% | 5% 3% | | | 21 13 8 | 4 11 5 1 | 18 3 | 10 11 22% 25% 18% | 19% 23% 22% 33% | 24% 15% | 16% 35% | | |
Figure 11.1 (Continued) Tables produced by the sample Quantum job
A Limits
80
characters for a data or program filename/pathname
198
characters per line (also applies to corrections files)
20 1000
error messages printed on the screen columns per card in multicard data records (read=2). No limit for read=0
327
highest card number that can be written out to a data file
247
items in a predefined (.in.) list
500
statement labels in an edit
300
logical items per logical expression. (A logical item is a variable name, an open or closed parenthesis, an integer, real or string constant, a logical operator, or a comma).
1024
characters per line in reports generated with report
32767
maximum record length (len=) on filedef statements
6
levels of nesting for loops
9
columns per field on field, fld and bit statements (3 under DOS)
32
different fetch files per run
50
characters in a fetch file pathname
32767 2 100 12 9
maximum fetch file record length numbers on first line of fetch file, with a maximum of 3 digits in first number and 8 in second number subroutine statements per run arguments per subroutine different merge files per run with mergedata
10
different fonts
10
minimum number of lines per page (paglen=)
10000
maximum lines per page (paglen=)
10
minimum page width (pagwid=)
10000
maximum page width (pagwid=)
120
characters of row text (side=)
Limits – Appenix A / 265
Quantum User’s Guide Volume 2
6 30
rows of bot titles per table (15 with underlining)
30
rows of foot titles per table (15 with underlining)
40
sid statements per table
500 15
maximum number of elements in all axes in a table created with und characters for a named filter name
253
characters for a named data, integer or real variable name
100
named filters
10
levels of nested filter titles (sectbeg/sectend)
7
decimal places for absolutes
7
decimal places for percentages
1073741823
maximum whole number that Quantum can handle
10
maximum number of characters that Quantum can use to print a figure in a table. Figures with more than 10 characters appear as asterisks.
54
hugged rows per hug= (minimum is 2)
867
named variables. Note that each inc= statement also counts as a named variable. (This limit can be increased.)
500
axes in a run. When calculating the number of axes in a run, Quantum counts each grid axis as two axes. (This limit can be increased.)
20000
characters per axis. (This limit can be increased.)
20000
characters in total for the unique IDs in an axis (text specified with uniqid=).
500 11 400 20 9
☞
dimensional tables
elements in a Quantum axis (n25=3 elements) (This limit can be increased to a maximum of 32,767.) rows of titles within an axis ranges per axis with val statements fields per fld statement columns per field on fld and bit statements. This is the limit that is built into Quantum. In practice, however, the limitations of the available resources on many systems impose a lower limit.
For information about changing user-definable limits, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
266 / Limits – Appendix A
Quantum User’s Guide Volume 2
150
logical items per fld statement. (A logical item is a variable name, an open or closed parenthesis, an integer, real or string constant, a logical operator, or a comma.)
499
bit arguments per fld statement. A single number, such as "Ten" or "Ten=10", requires 1 bit argument; a range of numbers on its own, such as "Five or Six=5-6", requires 3 bit arguments; in a list of values, each value in the list requires 1 bit argument, and 2 bit arguments are required to identify the list itself; if a list includes a range of numbers, the range is expanded so each number in the range requires 1 bit argument, so "Any Washo brand=1,3,7,10-12,14" requires 9 bit arguments.
50
$..$ constructs per fld statement
20
g statements per axis
200
characters per g statement
260
characters for column headings on p statements (first must be within 60 columns of the start)
30 3
minimum column width (colwid=)
64
maximum column width (colwid=)
9
levels of repeated texts with hold=
9
levels of nested headings with hdlev=
9
blank lines before column headings (linesbef)
9
blank lines below column headings (linesaft)
10
elements with rej=1 for each rej=0
32
subgroups per axis
600 12000 6 200 31
☞
vertical lines on a p statement
different incs (inc=c15 twice counts as one). (This limit can be increased.) characters for all variable names used with inc=. (This limit can be increased.) levels of nesting for #include/*include #include/*include files in a run symbolic parameters for columns (col(a)=)
For information about changing user-definable limits, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
Limits – Appenix A / 267
Quantum User’s Guide Volume 2
31
symbolic parameters for codes (punch(p)=)
14
symbolic parameters for texts (&txt=). (This limit can be increased.)
15
characters of indentation per indent=
7
levels of nesting for sorts
9
levels of nesting for nets
255 9
weighting matrices
9
axes per weight matrix
16
weighting axes per rim weighting run
500
items per axis in row/table manipulation expressions (not 16-bit DOS), where each component of an expression (for example, variable names, arithmetic symbols) counts as one item. (This limit can be increased.)
100
items per axis in row/table manipulation expressions (16-bit DOS) where each component of an expression (for example, variable names, arithmetic symbols) counts as one item.
6
ex statements per tab to be carried forward to and statements under the same tab
500
items per ex/ex= statement
200
characters per and statement
9 256 16 127
☞
maximum value for smallbase
Analysis levels characters for all level names together (each name ends with a null termination character, so each name is 1 character longer than it looks) levbase statements per run responses per respondent in a grid axis in a Quanvert database (quantum -v ignores any extra responses)
For information about changing user-definable limits, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
268 / Limits – Appendix A
Quantum User’s Guide Volume 2
1000
directories per multiproject database run
20
characters per profile postprocessor (profopt) name (non-DOS)
80
characters per profile help text (non-DOS)
120
characters per profile command (non-DOS)
There is no practical limit to the number of characters in the axis text heap. The text heap is made up of: all titles for the axis all element side texts any text set using the hd= keyword
Limits – Appenix A / 269
B Error messages This appendix lists the error messages generated by the various stages of a Quantum run. Explanations are included where the meaning of the message is not immediately obvious or where limits have been exceeded.
B.1 Compiler errors 0
Incorrect statement type You have probably mistyped or incorrectly specified a parameter on an edit statement or a card/column reference on a tabulation statement.
1
Keyword has spurious characters at end Keywords must be followed by spaces.
2
Only digits 0-9 allowed in numeric field
3
Integer or real keyword is outside permitted range The value associated with the keyword is higher or lower than is permitted.
4
Keyword not identifiable
5
Keyword cannot appear on this statement
6
tt or tb must be followed with l,r,c, or a digit
7
Duplication of . or /
in real number
Real numbers may contain only one decimal point. 8
Denominator of fraction is zero
9
Too many axes specified on statement Only two axes may be named on add, div, sid and und statements.
10
Bad dimensionality of tab statement All tab statements, other than those for grid tables, must name between two and six axes. Statements for grid axes name one axis followed by the word grid.
11
Limit of number of axes in run exceeded Increase the limit by setting the axes parameter in the maxima.qt file. For further information, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
12
Statement cannot occur within axis
Error messages — Appendix B / 271
Quantum User’s Guide Volume 2
13
Axis name is multiply defined You have two or more axes with the same name.
14
Too many tt statements in axes An axis must not contain more than eleven tt statements.
15
n card - nxx - xx not acceptable integer There is no n statement with this number.
16
Axis never defined One of your tables uses an axis which you have not yet created. Possibly, you have created it but have given it a different name.
17
Too many elements in axis The default limit for the number of elements in an axis is 500 elements, with n25s counting as three elements. You can increase the limit by setting the elms parameter in the maxima.qt file. For further information, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
18
Set of g cards not followed by p card Each set of gstatements must be followed by a p statement defining where numbers should be printed for each column defined on the g statement.
19
Too many g cards in group An axis may contain up to 20 g statements overall.
20
Total width of g cards too wide g statements may be up to 400 characters wide.
21
Insufficient p fields You have defined more columns on your g statement than you have marked on your p statement. p statements must define the same number of columns as the corresponding g statements.
22
Too many p fields You are pointing to more fields than have been defined on the previous group of g statements.
23
Invalid or duplicate name for named filter You have used the same name twice with different conditions.
24
Too many named filters 100 named filters are allowed.
272 / Error messages — Appendix B
Quantum User’s Guide Volume 2
25
Unknown named filter You have used a named filter which has not been created. Possibly you have created it, but have called it something else.
26
Number of p card points does not match axis def The axis defines more elements than there are columns defined on the p statement.
27
More entries on col card than allowed by ord There are only 12 positions in each column — your col statement thinks there are more.
28
Cannot recognize right side of = Quantum cannot understand the expression following the = sign.
29
This statement cannot have a condition The option =expression is not valid on this statement.
30
$ or ’ missing or not in matched pair Codes for a single column must be enclosed in single quotes; strings of codes for a field of columns must be enclosed in dollar signs.
31
p/q multipunch specification incorrect Ranges of codes must be entered in the order &-01234567890-&.
32
Incorrect keyword beginning .
33
Unanalyzable text in expression Quantum cannot understand what you have written - check that you have $, ’ and () in the correct places and that you have spelled all keywords correctly.
34
Wrong number of numbers or illegal range in val field Check that all ranges are specified in the form min–max, and that no number has more digits than the field you are referring to; for example, no numbers greater than 99 in a 2-column field.
35
Cannot parse expression Check that you have written the statement correctly and that you have not inserted additional punctuation where it is not necessary.
36
Unbalanced parentheses in expression Each opening bracket must be followed by a closing bracket, and vice versa.
37
Incorrect i:j construction in list Ranges are defined as min:max or min/max.
Error messages — Appendix B / 273
Quantum User’s Guide Volume 2
38
Incorrect entry in list definition Lists may only contain characters, whole numbers and ranges of whole numbers. However, the type of variable which will be accepted depends on the type of variable you will be checking.
39
Incorrect text to left of .in. The .in. operator may be preceded by data, integer or real variables.
40
Explicit or named list must follow .in. The list must be a series of numbers enclosed in parentheses, with numbers in the list being separated by commas. Alternatively, .in. may be followed by a name identifying a list defined previously with definelist.
41
( expected after variable name Cells in an array must be referred to as varname(cellnum) unless the array size is followed by the letter ‘s’ in the variables file.
42
) expected but not found All subscripts must be enclosed in parentheses.
43
Error in string type logical condition You have written a logical expression incorrectly.
44
Improper c=- or c=+ condition c=- and c=+ cannot be combined with any other condition: they must stand alone.
45
Cannot open specified file You have either named a file that does not exist or you do not have read access to the file.
46
Improper col or punch definition Symbolic parameters are defined as col(a)=nn and punch(p)=’p’.
47
Too many defines You have defined too many column, code or text symbolic parameters. You may have 31 column, 31 code and 14 text parameters, although you may increase the limit for text parameters if you wish. For further information, see section 1.10, ‘Userdefinable limits’ in the Quantum User’s Guide Volume 4.
48
Text substitution generates line too long to handle Lines may be a maximum of 200 characters long. You have defined a text string which, when substituted into the line, makes the line longer than this.
49
No = in text substitution You’ve forgotten the equals sign in the statement which assigns a text value to a variable.
274 / Error messages — Appendix B
Quantum User’s Guide Volume 2
50
Extraneous characters at end of condition
51
Cannot understand stat=chi sub-keyword You have made an error when specifying the options for the single classification chisquared test. Perhaps you spelled an option incorrectly or omitted the brackets.
52
0 value label You have misspecified a label number or have omitted it altogether.
53
Multiply defined label You have used the same number to label two or more different statements.
54
Too many labels in run There is a maximum of 500 labels per run.
55
Go to not followed by label
56
Spurious character at end of edit statement
57
If not followed by condition
58
No proper terminating ) in condition
59
Label never defined The label named with go to or do does not exist.
60
Do label previously defined Labels named on do statements must refer to statements which come after the do statement, not before it.
61
Else without preceding if
62
Emit/delete incorrectly specified
63
Variable is not of expected type
64
Do loop not terminated You have probably forgotten to put a label in front of the statement which terminates the loop. Alternatively, you have used the wrong label number on the do statement or on the statement which terminates the loop.
65
Improper specification of do loop
66
Do loops nested too deeply Loops may be nested to a depth of 25 levels: that is, 25 do statements before the innermost loop is terminated.
67
Rqd val must be between 1 and 7
Error messages — Appendix B / 275
Quantum User’s Guide Volume 2
68
= expected in set statement You have either omitted an = sign in an assignment statement, or you have written another statement incorrectly, so that Quantum thinks it is an assignment statement.
69
Cannot interpret set statement
70
Valid but unimplemented facility The statement you have tried to use does not yet exist.
71
Incorrect specification of partial column move Codes to be moved must be in the same relative positions in the two columns.
72
Cannot set field to single col constant You must enter as many characters as there are columns in the field. Use blanks or zeros if necessary, or deal with each column separately.
73
Improper subscripted variable Subscripts must be whole numbers or integer variables.
74
Incompatible string lengths of assignment operator
75
Punch expected Quantum expected a code (for example, ’1’).
76
= missing in keyword
77
Incorrect specification of variable
78
Improper left side of real column assignment (no or incorrect :) When real numbers are saved in real character variables, the notation :dp must follow the variable name to show how many decimal places are required.
79
Premature end of file Quantum has reached the end of the file before finding the end of your program.
80
Bad format in definecol statement
81
Level specified is undefined All levels must be defined in the levels file. Possibly you have misspelled the level name in your program or in the levels file.
82
No analysis level specified All tables and axes created from hierarchical data must have an analysis level defined with anlev=.
83
Uplev must be below anlev in hierarchy The level named with uplev is higher than that named with anlev.
276 / Error messages — Appendix B
Quantum User’s Guide Volume 2
84
Too many levbases in axis A maximum of 16 are allowed.
85
Function name must be followed by (
86
Too many vertical lines specified A maximum of 30 vertical lines are allowed.
87
Process can only specify lower level in hierarchy The level named with process is higher than that on the previous ed or level statement.
88
Second col spec must be greater than first Column specifications must be entered with the lowest column number first (for example, c(1,10) ).
89
Missing ser= and/or crd= in levels file The serial number and card type columns for hierarchical (trailer card) data must be defined in the levels file so that Quantum knows when the end of the record or read occurs.
90
No parent level specified All sublevels must name their parent in the levels file.
91
C variable expected
92
Celllev must be above anlev in hierarchy The level named with celllev is lower than that named with anlev.
93
No multiplier specified on n25 You have forgotten inc=.
94
Number of endsorts does not match number of subsorts You have more endsorts than subsorts, or vice versa. If you find that you do have matching pairs, check that each one is separated from the element text and other options by semicolons.
95
wm must precede all tabs
96
Incorrect number of cells in weight matrix You have defined more weights than there are cells in the tables which use this matrix, or vice versa.
97
Incorrect number of weighting axes The tab statement which uses this weighting matrix has more axes than you have named on the wm statement, or vice versa.
Error messages — Appendix B / 277
Quantum User’s Guide Volume 2
98
Base cannot be on col/val card on weighting axis Use an n10 or n11 instead.
99 100
wm must be integer between 1 and 9 Duplicate id on weight matrix You already have a weighting matrix with this number.
101
Weight matrix used but never defined You have forgotten to define this matrix, or you have called it something else.
102
Cannot resolve grid axis Check that you have defined the values for symbolic parameters correctly.
103
Keyword cannot be in top half of grid axis The notations ca00 and ’p’ cannot appear in the top part of a grid axis. Only col(a)= and punch(p)= are valid. The top part of a grid axis defines the values to be substituted in place of the symbolic parameters.
104
Keyword must be in top half of grid axis col(a)= and punch(p)= must appear in the top part of a grid axis. Only use ca00 and ’p’ in the bottom half to pick up the values of the symbolic parameters.
105
No ‘side’ statement in grid axis Row and column definitions must be separated by a side statement.
106
Cannot have fac=/scale=/percentile= on same tab or element
107
Improper col( )= or punch( )= spec
108
Second half of grid axes can only have one n25
109
Punch( )= not allowed on col cards when within grid axes Use n01s instead.
110
Incorrect form of priority statement
111
Incorrect entry in ttord/beg/end statement
112
Add or bnk must follow 2-d tab Only 2-dimensional tables can be added or banked.
113
Too many rej=0s in axis You may have ten elements in an axis with rej=0 for each element with rej=1.
114
Rej=1 without preceding rej=0
115
Keyword can only occur on a ‘basic’ row Basic rows are those created directly from the data, that is, n10, n11, n01, n15 and their counterparts on col, val, fld and bit statements.
278 / Error messages — Appendix B
Quantum User’s Guide Volume 2
116
Illegal characters following ‘ed’ statement Only level names defined in the levels file may follow ed.
117
Variable subscript out of range You are trying to refer to a non-existent cell in an array; for example, brand(10) when brand has be defined as having only 6 cells.
118
Illegally defined variable subscripts Subscripts may be whole numbers or integer variables.
119
M card must have an ex= option on it Quantum needs to know how to manipulate the data in order to create this element.
120
Missing text after keyword
121
Reverse polish stack full There is no room to store the rest of the axis manipulation expression. Increase the limit by setting the environment variable QTMANIPHEAP to the desired value or by setting the manipheap parameter in the maxima.qt file. For further information, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
122
Reverse polish stack empty The manipulation expression has not been converted into anything.
123
Invalid expression following ex=
124
Unbalanced parentheses Each ( must have an ), and vice versa.
125
Unexpected comma in expression
126
Incorrect number of arguments for function You have enclosed to many or too few items in the parentheses.
127
Element text or identity name not defined
128
Non numeric element specified Only elements which create numbers can be manipulated.
129
Null text due to empty quotes
130
Only constants allowed in braces A manipulation expression enclosed in braces defines the values to be placed in the row or table. These must be numbers, not variables.
131
Unbalanced braces Each { must have an }.
132
Illegally defined element
Error messages — Appendix B / 279
Quantum User’s Guide Volume 2
133
Element out of range
134
Invalid identity name IDs
135
must start with a letter and may be up to six letters and/or digits long.
Too many variables The default limit for the number of named variables and inc= statements in a run is 867. You can increase the limit by setting the namevars parameter in the maxima.qt file. For further information, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
136
Invalid wttran statement
137
Invalid expression on ex card
138
Missing = in scale keyword
139
Missing = in inc keyword
140
Element id or named filter name too long Element IDs cannot be more than six characters and named filter names cannot be more than 15 characters.
141
Unfinished expression
142
Null element on col/fld/bit card You have typed two or more consecutive semicolons. Delete one of them or insert an element text.
143
Invalid character following U statement U may only be followed by 1, 2 or 3.
144
U statement can only appear after G statement
145
Bad syntax of font= definition
146
Font number out of range
147
Invalid sub-keyword on font= definition
148
Reserved variable name You have used a Quantum keyword or a C language term as a variable name. This is not permitted.
149
Variable not defined Variables must be named, and their dimensions defined, in the variables file or somewhere in the edit before they are used.
150
Invalid character in variable name Only letters and numbers are allowed. Names must start with a letter.
280 / Error messages — Appendix B
Quantum User’s Guide Volume 2
151
Invalid character in axis name Letters and digits only allowed and axis names must start with a letter.
152
Null or ambiguous order= on struct card
153
This keyword can only appear once per axis
154
Invalid or reserved name on subroutine statement The items named within the parentheses must be variables. You have used something that is not a variable.
155
Non-unique name on subroutine statement You have two or more subroutines with the same name.
156
Too many different include files A maximum of 200 include files is allowed.
157
Setting/comparing different numbers of columns There are more columns in the variable on the right of the = sign than there are in the variable on the left.
158
Named variable defined after executable statements Variables used by subroutines must be defined in the variables file or before the ed statement. Variables defined after ed cannot be used in subroutines.
159
Illegal parameter format on subroutine statement Items within parentheses must be separated by commas.
160
Illegally defined or undefined subroutine parameter(s) You have either forgotten to define one of the variables in the parentheses, or you have defined it incorrectly.
161
Illegal format for filedef statement
162
Illegal format for report statement
163
Illegal file type File types are Data, Print and Report.
164
Merge type must be between 1 and 6
165
Non-existent merge file specified You are trying to merge data from a file that does not exist. Check that you have typed the correct name.
166
Too few/many merge files specified You must name between 1 and 13 files.
Error messages — Appendix B / 281
Quantum User’s Guide Volume 2
167
Necessary merge info missing from struct card/levels file You have not said where the serial number/card type/sequence number is.
168
Multicard job may not have reclen= greater than 1000
169
Too many inc=’s specified The default limit for the number of inc= in a run is 600. You can increase the limit by setting the incs parameter in the maxima.qt file. For further information, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
170
Inc=’s names too long in total The default limit for the number of characters for storing the names of inc= variables is 12000. You can increase the limit by setting the incheap parameter in the maxima.qt file. For further information, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
171
More than 6 ex cards before and card
172
A digit must follow NET/NTT/NETEND Nets may be nested, so Quantum needs to know the level at which this net should be created/terminated. Top level nets are defined with net1, subnets with net2, and so on.
173
Missing NET level Net levels must be numbered sequentially from 1 to 9. You cannot skip from, say, net1 to net3.
174
Netend keyword may only appear on last element of col/val card If you want to end a net with an element which is in the middle of a col/val statement, split the col/val statement up and write that element with an n01.
175
Null statement You have an extra parenthesis at the end of a statement, or two adjacent commas or semicolons with nothing in between.
176
Too many levels Up to 9 levels are allowed with hierarchical data.
177
Axis name truncated to seven characters
178
Syntax error
179
require = needs more than one condition If you only want to check that one expression is true, use require (expression) instead.
180
Spare (unused) message number
282 / Error messages — Appendix B
Quantum User’s Guide Volume 2
181
Incorrect specification of inc( grid variable Inc must be followed by a number in parentheses when used in a grid axis.
182
Assignment of illegally overlapping columns
183
Online statement found without punch or split statement Without a punch (write) or split statement to create the clean and dirty data files, corrections made with the on-line edit facility will be lost as Quantum never alters the original data file.
184
Function can only have one element
185
Call fprint replaced with call qfprnt
186
Struct card found after edit section The struct statement must appear before the edit section so that Quantum knows how to read the data into the C array.
187
Logical expression too long The limit on either the complexity of an edit statement or the complexity of a definelist has been exceeded. You can increase these limits by setting edheap and inlistheap to higher values. For further information, see section 1.10, ‘Userdefinable limits’ in the Quantum User’s Guide Volume 4.
188
Invalid digit following and Only digits 1 to 6 may appear with and.
189
Do loop may not follow if condition Do loops may not be part of an if or else statement. If you want the loop to be executed for certain records only, use if with go to to route ineligible records around the loop.
190
First report filedef must not be in subroutine Remove the filedef from the subroutine and place it at the start of the edit section.
191
reclen= greater than C matrix given after C matrix definition
192
C subscript < 99 with multi-card job Multicard records are read into columns 101 onwards of the C array. c(1,100) contain the first card of the next record or the next trailer card of the same type as that just read (for example, a second card 2). To process your data correctly, change the subscript so that it refers to a card type and a column (for example, c123 for column 23 of card 1).
Error messages — Appendix B / 283
Quantum User’s Guide Volume 2
193
%c= or %rej found on col/val/fld/bit statement The codes which represent elements defined using col, val, fld and bit are implied by the element’s position on those statements, or as part of the element definition. c= is only valid on n statements. Don’t confuse rej=0/1 which are used to reject records belonging in one element from a second element, with =rej which counts respondents not present in any previous element in the axis. rej=0/1 may be used on col, val, fld and bit statements as well as n01s; =rej is not valid on n01s.
194
Illegal flag ‘no’ or ‘-’ on keyword You have tried to switch off an option by preceding it with ‘no’ when this is not valid for that keyword.
195
Illegal extra text on keyword
196
Missing text on keyword
197
Illegal format following inc= or alpha This message indicates that you made an error when you specified an inc=, a namedinc or a namedalpha. inc= must be followed by an arithmetic expression. namedinc must be followed by a data spec that gives an integer or float result. namedalpha must be followed by a column spec that defines one or a range of columns.
198
a card found with no tab or wm statements The a statement defines global options for the tabulation section of a Quantum run. If your run is an edit-only run, remove the a statement from your program.
199
Illegal combination of keywords on struct statement You have mixed options which refer to single-card records with options which refer to multi-card records.
200
Overlapping serial cols and card type cols
201
Serial and/or card type in columns >100 with multi-card job
202
B statement obsolete - please use struct
203
First tab is add or div Add and div statements must follow a tab statement - check that the first table is defined on a tab statement.
284 / Error messages — Appendix B
Quantum User’s Guide Volume 2
204
Add or div tab has more cells than original tab When tables are added together or divided, Quantum counts the number of cells in each table and adds or divides cells in corresponding positions (for example, cell 4 of the tab table is divided by cell 4 of the div table). It does not take account of the position of the cells in the printed output. In order for cells to be added or divided correctly, tables defined on add or div statements must be the same size as the parent table. If the add/div table is larger than the parent table, insert dummy elements in the parent table to pad it to the required size.
205
Sid tab with too many/few rows The notes for message 204 apply.
206
Und tab with too many/few cols The notes for message 204 apply.
207
Sid or und refers to multi-dimensional tables These statements may only be used with two-dimensional tables.
208
Sid and und cannot be mixed in same table
209
Real constant cannot be used as subscript Subscripts must be whole numbers or integer variables, or data variables which contain valid whole numbers.
210
Cannot set col() = blank in grid
211
An include file cannot start with a continuation
212
Stats element has no elements on which to calculate statistic Check that the stats element is preceded by at least one n01, col or val statement.
213
n30 must have monotonic series of fac= values Percentiles created with n30 use the factors defined on the previous elements with fac=. These factors define the highest point in each range and must be defined in sequential order. Check that you have defined a factor for each element and that they appear in sequential order. If you are trying to calculate percentiles using the values in the data, use an n01 with inc and percentile=.
214
Stats element has no preceding n25 or elements with fac= Either add fac=to the individual elements or put inc= on the n25.
215
Add or div table has fewer cells than original tab The notes for message 204 apply.
216
Keyword duplicated You have used the same option twice on the same statement.
Error messages — Appendix B / 285
Quantum User’s Guide Volume 2
217
Construct of the form c(cM,N) or c(M,cN) found Remove the c from inside the parentheses.
218
Ed statement found after start of tabs section If you wish to include edit statements inside the tab section, they must be enclosed between #ed and #end statements.
219
Reclen with value > 100 found
220
Ex= may not be used on stats element
221
Spare (unused) message number
222
Startlev/changelev not yet available
223
ttord/beg/end=base and baft may not both be specified Either remove end from the ttbeg/end/ord statement or remove baft.
224
Tab anlev is at higher level than axis anlev Either change the tab anlev to be the same as that on the axes and add celllev=higher-level to the tab statement, or change the axes anlevs to match the tab anlev and putuplev=lower-level on the axes. Which you do will depend on the sort of counts you wish to see in your table.
225
Illegal sequence of statements in tabs section All tab statements must be entered before axes are defined. flt statements must precede the tab statements whose filters and conditions they define.
226
n30 and stat z1 must have non-zero fac= The factor on the n30 defines the percentile to be calculated (for example, fac=10 for the first decile). The z1 statistic compares the values in a row against a given percentage. You have either omitted the factor/percentage, or it is zero.
227
Invalid statistical test
228
Invalid table for statistical test Your table does not have the correct dimensions or contain the correct information for the type of test you are requesting.
229
No base row The statistic you are requesting requires a base row.
230
No base column The statistic you are requesting requires a base column.
231
No (n12) mean The statistic you are requesting requires a mean element.
286 / Error messages — Appendix B
Quantum User’s Guide Volume 2
232
No (n17) standard deviation The statistic you are requesting requires a standard deviation element.
233
Wrong number of basic count rows The table contains too few or too many basic count rows (that is, n01/n15/n10/n11/ col/val/fld/bit).
234
Wrong number of basic count columns The table contains too few or too many basic count columns (that is, n01/n15/n10/n11/col/val/fld/bit).
235
Axis not tabulated by itself on Z-Test type 4
236
Statistical test requires base element in axis
237
Wrong number of basic count elements
238
Unrecognized entry in stat= keyword The statistic you have named with stat= on the tab statement is not a table-level statistic.
239
Invalid option on graph keyword
240
Overlap keyword found on non-2-D or grid table
241
And statement after tab with overlap keyword
242
Tstat statement in illegal position in run The tstat statement must follow the tab which defines the table on which the test is required.
243
Cannot malloc heap for tstat info There is insufficient memory for Quantum to store the statistical information.
244
Duplicate or unknown tstat type
245
Tstats prop/mean and nkl may not be run on same tab
246
Illegal number of letters in tstat group Some tests must be run on a set number of columns. Check that you have followed the rules for the test you want.
247
Illegal member in tstat elms= group
248
Overflow of tstat info heap
249
No elms= keyword on tstat statement You have forgotten to tell Quantum which elements to test.
250
NSW
element may not be flagged as unweighted
Error messages — Appendix B / 287
Quantum User’s Guide Volume 2
251
Median/percentile keyword must have inc= keyword If you want to create percentiles using the values in the data, you must tell Quantum to read those columns into its median calculation.
252
inc= not allowed on L statement of grid axis
253
No elements defined on col/val card
254
% keyword found before any elements on col/val/fld/bit card Options can only follow elements; they may not precede them.
255
Too many chars in axis text heap The maximum number of characters per axis (default 20,000) has been exceeded. Increase the limit by setting the heap parameter in the maxima.qt file. For further information, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
256
Unknown tcalc= subkeyword
257
Punch in loop cannot be blank Loops which use punches (codes) on the do statement can only deal with the codes 1/&.
258
Same punch used in nested loops
259
Loop punches not allowed in lists or partial col move
260
dimen may not be specified greater than a-card value or a-card placed wrongly You are asking for a table which is wider than the default for this run. Either change the default so that it accommodates the larger table, or reduce the size of the current table.
261
paglen may not be specified greater than a-card value or a-card placed wrongly You are asking for a table which is longer than the default for this run. Either change the default so that it accommodates the larger table, or reduce the size of the current table.
262
Field must be followed by ‘int-array =’
263
Invalid string spec on field/fld
264
Invalid column spec on field/fld
265
ori value must be 0 or 1
266
Invalid field width on field/fld
267
Last col is not multiple of field width from first col All fields must have the same number of columns.
288 / Error messages — Appendix B
Quantum User’s Guide Volume 2
268
String wrong length in string spec on field/fld You have defined a string that has more codes than there are columns in the field.
269
Value outside valid range on field/fld/bit You have defined a code that has more digits than there are columns in the fields you have defined.
270
bit must be followed by int-array The bit keyword must be followed by the name of an integer array whose cells determine which elements each respondent belongs in. This array is created with a field statement in the edit.
271
base/base= only allowed at start of fld/bit You have a fld or bit statement in which a base element appears after some ordinary elements. The base element must come first after the column reference or array name.
272
=rej element only allowed at end of fld/bit You have a fld or bit statement in which an element of the form element_text=rej appears somewhere other than as the last element on the statement.
273
String spec not allowed on bit The bit statement names the array defined using field in the edit. The array is identified by just its name; for example, films not films(1,6).
274
Too many $$ specs for one fld - please split into many flds Your element definitions refer to more codes than can be stored in the columns you have defined (for example, 100 codes for a 2-column field).
275
Too many values specified for one fld/bit The specification of the element values in a fld or bit statement requires too many bit arguments; for details, see Appendix A, Limits, in the Quantum User’s Guide, Volume 4. Change the specification so that it requires fewer bit arguments or put another fld statement before the number that exceeds the limit
276
Invalid value spec on fld/bit You have defined a value which is too large to fit in fields you have defined.
277
Invalid range specified on fld/bit You have defined a value which is too large to fit in the fields you have defined.
278
Spurious characters at end of columns spec on field/fld The column reference on your field or fld statement has some extra characters at the end of it. Quantum accepts field references in a number of forms, so check the documentation for these statements to verify that you have not muddled two formats.
Error messages — Appendix B / 289
Quantum User’s Guide Volume 2
279
Illegal just= specification
280
Must specify same or ancestor level
281
Split statement in illegal position in levels run Split must be part of the top-level edit in a levels job.
282
Duplicate level/endlevel section You have written two sets of edit statements for the same level. Either combine them, or use endlevel to have one set executed when all data for that level has been read. Alternatively, you may just have typed the wrong level name the second time.
283
Axis tabbed as grid and non-grid Grid axes can not be used in non-grid tables, and vice versa. If this is what you want, write the axis twice, once in grid format and once in standard format.
284
Grid may not appear directly after tab or after L You have forgotten to enter the name of the grid axis.
285
Cannot appear in a numcoded axis This message warns you that data in an axis flagged with numcode may be multicoded. This may be because you have placed a net, ntt, c=+n, c=+, c=-n, fld or bit statement on the axis.
286
Illegal text following axreq= You have used a keyword that is not valid with axreq=, or you have mistyped a keyword.
287
subsort/endsort not allowed with netsort Netsort inserts its own subsort/endsort keywords on the elements comprising each net. Either remove the subsort/endsort options from your elements, or remove netsort from the a or l statement. If you remove netsort, you may need to enter your own indenting as part of each element text.
288
a/flt/tab statement with inc= but no anlevel defined Your run or table has cell counts incremented by a given value, but you have forgotten to include an anlev option indicating the level at which the table should be created.
289
groupend with no corresponding groupbeg You have defined the end of a group without defining its beginning.
290
Subgroup in more than one axis You have defined a subgroup with a name which already exists in another axis. An axis subgroup may contain elements in one axis only: you cannot create a subgroup comprising elements from two or more axes.
290 / Error messages — Appendix B
Quantum User’s Guide Volume 2
291
Too many subgroups for one axis Your axis has more than 32 subgroups.
292
Subgroup defined within itself You have tried to create a nested subgroup with the same name as the parent (outer) subgroup. For example, subg1 within subg1, rather than subg2 within subg1.
293
groupbeg without groupend - groupend assumed at axis end The axis contains a groupbeg statement without a corresponding groupend. Quantum will assume that the group ends at the end of the axis. If this is not correct, insert a groupend statement at the appropriate place.
294
Subgroup tabbed before main axis (cannot be flipped) Your list of tab statements names the subaxis before the axis of which it is a part. You will not be able to flip this axis for use with Quanvert. You are advised to alter the order of the tab statements so that the subaxis is tabbed after the main axis.
295
Subgroup may not be in top of grid axis
296
tstat nkl not yet implemented on grid table
297
Keep and op=A or op=B may not appear on the same element/tab Your spec is requesting a percentage difference which would require subtracting a percentage from itself. op=A/B must appear on a different element from keep.
298
op=A and op=B may not appear on the same element/tab op=A and op=B are mutually exclusive. They cannot appear together.
299
nontot keyword interpreted as ntot
300
Statement in illegal position in run
301
and cannot follow grid table
302
Cannot add tables with celllevel specified
303
Grid axis with no substitution
304
Specification of (m,n) where m=n Your field reference refers to a single column only. This is not technically incorrect, but it may not be what you intended. If not, check your spec.
305
n19/n20 in weighted grid column may give incorrect figures This is not an error, but a warning. Quantum is not always able to produce the correct figures in tables of this type, so check your results carefully.
306
grptitle may only appear on element in exactly one subgroup
307
lsd keyword only valid on tstat mean or propmean
Error messages — Appendix B / 291
Quantum User’s Guide Volume 2
308
Obsolete nsw element ignored At one time you had to insert nsw statements in weighted tables/axes which requested special T statistics. Quantum now does this automatically if you place the option nsw on the a statement. This message is just a warning that Quantum has found an nsw statement in a table or axis spec as well as on the a statement and has ignored it.
309
Tstats and wms but no nsw on a-statement At one time you had to insert nsw statements in weighted tables/axes which requested special T statistics. Quantum now does this automatically if you place the option nsw on the a statement. You have weighted tables and T statistics, but have forgotten to add nsw to the a statement.
310
Too many nested sections You have more than ten sectbeg statements without a sectend.
311
Section has been begun but not ended Your spec has more sectbeg statements than sectends. Alternatively you have placed a flt statement within a nested filter section; that is between sectbeg and sectend statements.
312
Sectend without sectbeg Your spec has more sectend statements than sectbegs.
313
Bad format of mergedata
314
NFT
315
hdlev= may not be less than immediately preceding one
may not have row/col/high set on
Levels for n23 subheadings are numbered from one, with one being the highest level heading. Therefore, the higher the subheading (that is, the more elements it belongs to), the lower its number. Once you have printed subheadings at one level, you cannot then print subheadings at a higher level. Check that the level numbers for subheadings increase as you move through the axis. 316
Unknown hdpos= positioning info Acceptable positions with hdpos are l, c and r for left, centered and right justification of headings. The default is hdpos=c.
317
More than one wttran for same matrix You may transfer weights from each weighting matrix into the data once only. You have two wttran statements naming the same matrix.
292 / Error messages — Appendix B
Quantum User’s Guide Volume 2
318
Numeric specs must come before $$ on fld/bit Numeric fields may contain non-numeric codes to represent answers such as don’t know or no answer. You can include these responses in a fld or bit specification by enclosing the non-numeric codes in $ signs. However, specifications of this type must come at the end of the fld or bit statement. You have written a statement that defines non-numeric codes in the middle of the numeric specifications. If this is really what you want, split the specification into a number of fld or bit statements so that the non-numeric specifications come at the ends of the statements.
319
Axis has no elements
320
Axis has no basic elements Basic elements are elements that are created by reading the data. They are created by n01, n15, n10 and n11 statements and their equivalents on col, val, fld and bit statements. Although the axis may contain other elements that produce numbers (such as, statistical elements), it does not contain any that appear in this list.
321
Min weight cannot be >= max weight
322
Min/max weight must be > 0.0 All weights must be positive values greater than zero. You have specified a minimum or maximum weight with minwt= or maxwt= that is zero or less than zero.
323
basecol or extmap argument incorrect
324
Non-printed row has tstatdump flag, will not print in dump
325
Spare (unused) message number
326
auto-nsw element in grid top not implemented Your run has the option nsw on the a statement so that Quantum will automatically insert an nsw statement at the top of each axis. Your run contains a grid axis and, currently, Quantum is unable to process this specification.
327
Level already defined You have either used the same name for two different levels or you have defined the same level twice.
328
Parent already specified for this level You have defined the same level twice but each definition shows the level as belonging to a different parent level.
329
struct statement cannot appear with levels file Your project directory contains a struct statement and a levels file. If you are working on a levels project you may define the data structure either on the struct statement or in the levels file. If your project is not a levels project and you have used the levels file for something else, just rename the file. Error messages — Appendix B / 293
Quantum User’s Guide Volume 2
330
No levels defined
331
Blank in punch constant ignored Your run contains a punch()= specification that contains a blank code which Quantum is going to ignore. For example, if the specification reads punch(p)=’ 1’ Quantum will treat it as punch(p)=’1’.
332
Weight line needs one target or factor Your run declares weighting information in an axis but your have not said whether the weights are targets or factors. To correct the error insert either target or factor in the elements that define weights.
333
wm= must specify one non-grid axis Your run declares weighting information in an axis, but the wm statement that assigns a number to the weight matrix points to a grid axis. Weighting can only be declared on n01 statements in ordinary axes.
334
Use of overlap with median not allowed Quantum cannot create n01 medians on overlapping data. Specify the median by using an n30 statement and factors, instead of an n01 statement with inc=. If this is not possible, retain the n01 specification and run the table without the overlap keyword.
335
Integer constant too big You have specified an integer that is outside the range ±1073741823, or an arithmetic expression has produced a value outside this range and you are trying to assign that value to a variable.
336
smsupa/t/c/p= and smbase= may not both be specified smbase= which suppresses all percentages in a column or row if the base for the percentages is less that the given value is incompatible with the smsup group of options. You have a table that requests both types of suppression. Edit your spec and remove either smbase= or smsupa/t/c/p= from that table.
337
Text string within $’s contain too many characters You have specified a text string with more than nine characters in a fld or bit statement. There is a limit of nine characters.
338
Different description for same numeric or alpha A description specified for a numeric or alpha variable differs from the description you specified for the same variable earlier in the spec. Quantum will use the first description it encounters for the variable and will ignore any subsequent descriptions. The test is case-sensitive.
339
inctext= with no inc= inctext= is only valid with the inc= option.
294 / Error messages — Appendix B
Quantum User’s Guide Volume 2
340
summary on non-ex= elem ignored The summary keyword is only valid on ex= elements.
341
summary on non-basic ex= elem will generate 0 in cells
342
anlev= specification on axis must match usage The analysis level on an axis used in a weight matrix must be the same as the analysis level defined for the weight matrix.
343
Too many chars in elements uniqid= text heap You have exceeded the limit for the total number of characters available for unique ID names in one axis. The limit is 20000 characters.
344
Sum of characters within $’s exceeds limit You have exceeded the size limit for long text strings enclosed in $’s, for example, in a definelist. The default limit is 1024, but you can increase it by entering a higher value for lexchars in the maxima.qt file. For further information, see section 1.10, ‘User-definable limits’ in the Quantum User’s Guide Volume 4.
345
Cannot resolve $_uniqid$ (uniqid= missing) You can only use the $_uniqid$ syntax if you have specified a unique ID on the element using uniqid=.
346
Invalid special response text construct ($X(...)$) You have specified a special response of the form $x(...)$ where x is a single character. This construct is only valid if x is the _ character, and then the construct is used to indicate that the text within the brackets is a unique ID.
347
lang= on flt/sectbeg/tab must be preceded by lang= on a-card You need to define the default language on the a statement.
348
Cannot create/open language ptf file Either you do not have the correct permissions to update the file or the file is corrupt.
349
Spare (unused) message number
350
Same inc= at two different levels You have used the same numeric field or variable at more than one level. For further information, see Numerics with levels in Chapter 3 of the Quantum User’s Guide Volume 3.
Error messages — Appendix B / 295
Quantum User’s Guide Volume 2
351
Cannot use mapvar with definelist containing strings You have referred to a definelist in an .in. statement that contains a data-mapped variable. Quantum cannot handle this syntax because it needs to read the data in the definelist differently for data-mapped variables (as strings instead of column punches) but does not know at the time the definelist is parsed whether it will be used with a data-mapped variable.
B.2 C Compiler errors Code segment too large This message is the result of a problem in one of the files editQ.c or axesQ.c that the Quantum compiler creates from the edit and axes sections of your run: •
editQ.c contains everything that was in your edit section, translated into the C programming language.
•
axesQ.c contains just the c= conditions from n statements and their equivalents on col, val, fld and bit statements.
The error message means that the amount of code that needs to be processed is too large. The only solution to this problem is to reduce the size of the code. If the problem is in editQ.c, look for lines of the form: if (c(123,124)=$99$) .....
If you find a lot of these lines, see if you can replace them with loops or fetch files. If the problem is in axesQ.c, look for statements of the form: n01Element text;c=c(132,134)=$123$
As in the edit section, this type of coding is inefficient and would be better defined using an integer variable defined in the edit section: int myvar ed myvar=c(132,134) end .... n01Element text;c=myvar.eq.123
296 / Error messages — Appendix B
Quantum User’s Guide Volume 2
Also look for places where the number of conditions on elements can be reduced by filtering at a higher level. For example, look for places where you can use c= on an n00 statement or on the l statement. An even better solution would be to move some of the filtering from the axis section into the tabs section. If you are having difficulty locating the source of the problem, try commenting out sets of tab statements and rerunning the job until you find the offending axis.
B.3 Datapass errors Array dimension error This message is the result of referring to a nonexistent column of the C array. The most likely cause is a subscripted column reference such as c(t1), where the value of the subscript is zero or negative.
B.4 Accum Errors A number of the messages issued by accum refer to temporary files, and you will often see the message: Fileno number: time time dev dev mode mode size size giving information about the file. number is the file number, time is the time, dev is the device on which the file is open, mode shows how Quantum opens the file (for example, read or write) and size is the number of characters in the file. No tables could be done in this pass - run terminated Accum processes tables in batches. It works through the requested tables sequentially and processes as many as it can fit into memory in one batch. It continues processing tables in batches until it has processed all tables. However, if a single table requires more memory than is available, accum will be unable to process that table and issues this message. No tables to be done This may be because either there were no tables specified in the run, or Quantum was unable to open intermed.q or seg1. Cannot fit axes in buffer There are too many elements in an axis.
Error messages — Appendix B / 297
Quantum User’s Guide Volume 2
Fatal error - More than n cols in Overlap Grid Too many columns were specified in a grid axis with overlapping data (n is the maximum allowed). Fatal Error Overlap An internal error occurred while processing overlapping data. Insufficient Overlap Cells Quantum ran out of memory while processing overlapping data. Error in reading AXFILE An error occurred while reading the axis control file called AXFILE. Cannot create nums Quantum could not open nums for writing. Cannot malloc n bytes for median calculations Quantum ran out of memory while processing medians; n is the amount of memory (in characters) required. calloc for medians info array failed at m2_done n records Fatal error: cannot find table containing cell n Buffer size less than record size File is not an integral number of records These messages indicate internal errors while processing medians. Cannot open median2.qt for medians calc An error occurred when Quantum tried to open the file median2.qt for reading. Cannot allocate space for medians calc Quantum ran out of memory while calculating medians. Cannot close FILENAME Can’t open file FILENAME mode MODE Quantum could not open the named file. MODE shows how Quantum wanted to open the file and will usually be either Read or Write. Premature eof on intfile There were problems reading intermed.q. Premature eof on level file n There were problems reading the intlevn.q, where n is the level number.
298 / Error messages — Appendix B
Quantum User’s Guide Volume 2
Premature eof on intfile There were problems reading wmvalsn.q, where n is the number of the weighting matrix held in that file. Cannot set up mlttable axis_name Cannot set up unwt table axis_name Cannot set up sqtable axis_name Quantum ran out of memory while setting up temporary tables for the named axis.
B.5 Qout Errors nums ran out early nums is the file containing the values calculated during the datapass. It is read by the table output program, qout. The message means that qout could not find sufficient values in nums to fill the cells of the tables. There are a number of reasons this could happen: •
A previous run filled up the disk so the datapass could not write the complete nums file to the disk. This is most likely to happen under DOS but could happen on any machine.
•
You ran a complete job using options to retain Quantum’s temporary files. You then edited the table specs and reran qout. If the changes you made increased the size of any table, then qout will now be attempting to process a nums file with fewer values than the new specs require.
•
You ran the datapass and output stages as separate jobs but at the same time. qout was therefore trying to extract values from nums before they were there.
Error messages — Appendix B / 299
C Options in the tabulation section Keywords preceded by an asterisk may be used with the prefix no to switch off a global requirement for a specific table or element only. If the keyword is followed by an equals sign it is omitted when no is used (for example, inc= becomes noinc). Option
* * *
*
* *
* * * * * * *
acr100 anlev= axcount axreq= axtt baft base byrows c= celllev= clear= clevel= coltxt= colwid= csort= date dec= decp= dp dsp dummy effbase endnet endsort ex= exportmp fac= figbracket figchar= figpre= figpost= flt= flush
a/flt/tab/sectbeg
l
n/col/val/bit/fld
Yes Yes a only a only Yes Yes — — Yes tab only — Yes — Yes Yes Yes Yes Yes a only Yes — — — — — Yes — — — — — not a Yes
— Yes — Yes — — — Yes Yes — Yes — — Yes — — — — — Yes — — — — — — — Yes Yes Yes Yes — —
— — — — — — Yes — n only — — — n03 only Yes — — Yes — Yes Yes n01 and n15 only Yes Yes Yes Yes — Yes Yes Yes Yes Yes — —
Options in the tabulation section — Appendix C / 301
Quantum User’s Guide Volume 2
Option
*
* *
* * *
font graph group= hd= hdlev= hdpos= hold= hitch= hug= id= ignorezeros inc= inctext= indent= keep= lang= levbase linesaft linesbef manipz maxim means median medint= minbase= minim missing= missingincs missingval netsm netsort= nocol noexport nohigh nooverlapfoot noprint noround norow nosort
a/flt/tab/sectbeg
l
n/col/val/bit/fld
Yes Yes — — — — — Yes — tab only — Yes Yes Yes tab only a and tab only — Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes a only — Yes a only — — — Yes Yes — — —
— — — Yes — — — — — — — Yes Yes Yes — — — — — — — — — — — — Yes — — Yes Yes — — — — — — — —
— — Yes not n n23 only n23 only Yes — Yes Yes n07 only Yes Yes Yes bases only — Yes — — — Yes Yes Yes — — Yes Yes — Yes — — Yes Yes Yes — — Yes Yes Yes
302 / Options in the tabulation section — Appendix C
Quantum User’s Guide Volume 2
Option
*
* * *
*
* * * * * * * * *
* *
* *
notauto notstat notbl nsw ntot / nontot numcode= nz nzcol nzrow op= overlap page paglen= pagwid= pc pcpos= pcsort pczerona percentile= physpag printz rej= rinc round rsort scale= side= smallbase= smbase= smcol smflag= smrow smsup+ smsupa= smsupp= smsupt= smtot= sort sortcol
a/flt/tab/sectbeg
l
n/col/val/bit/fld
Yes — Yes a only — — Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes a only Yes — Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes — Yes Yes Yes Yes Yes —
— Yes — — — Yes Yes — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — Yes —
— Yes — — Yes — Yes — — Yes — — — — — Yes — — Yes — — Yes — — — Yes — — — — — — Yes Yes Yes Yes — Yes Yes
Options in the tabulation section — Appendix C / 303
Quantum User’s Guide Volume 2
Option
* * * * * *
*
* *
spechar= squeeze= stat= subsort summary supp tabcent title topc toptext= tstat tstat tstatdebug ttbeg= ttend= ttord= tx= type unl uplev= useeffbase wm= wmerrors
a/flt/tab/sectbeg
l
n/col/val/bit/fld
Yes Yes Yes — — — Yes Yes Yes — Yes tts a only Yes Yes Yes — Yes tts — a only Yes a only
— — Yes — Yes — — — — — Yes tts — — — — — — tts Yes — — —
— — — Yes Yes Yes — — — Yes Yes — — — — — not n — Yes — — Yes —
304 / Options in the tabulation section — Appendix C
Index This index covers all four volumes of the Quantum User’s Guide. The page references consist of the volume number followed by the page number; for example 2-6 is page 6 of Volume 2, 3-166 is page 166 of Volume 3, and so on.
A a, global tabulation parameters 2-8 in tabcon format file 3-190 options on 2-9 Absolutes decimal places with 2-113 position of percentages relative to 2-18, 2-117 print character before/after 2-41, 2-114 print characters next to 2-81 requesting in tables 2-16 side by side with percentages 2-17 suppress small 2-21, 2-117 ac, accept codes in online edit 1-165 Access rights on files in Quanvert Text 4-81 Accum error messages 297, 4-163 Accum program 1-229 acr100, 100% on base row 2-10, 2-32 Action codes with require 1-145, 1-146 ad, create cards in online edit 1-166 add, add tables 2-182 dummy elements with 2-186 example of 2-184 options with 2-186 Quanvert 4-71 sample program for 2-183 with offsets 2-183 Adding table 2-182 Addition 1-26 Aided and unaided awareness, example of 2-230 Alias file for qvpack/qvtrans 4-128 Aliases for Quantum statements 4-6 allread, cards read for current respondent 1-50 with write 1-66 alp files 4-94 Alpha variables, for Quanvert 4-73, 4-74 Alphanumeric card types 1-58 alter, texts in Quanvert Text 4-83 Analysis levels see Levels Analysis of variance Friedman’s two-way 3-85 one-way 3-110 example 3-110 formula 3-119 .and., logical comparison (both) 1-39 and, axes for additional tables 2-178 with flt 2-218 and, logical operator for assignment 1-100
anlev=, analysis level level at which to update 2-10, 2-40, 3-53 weighting with 3-12 with grids 2-245 anova, one-way analysis of variance 3-110 Arguments for subroutines 1-188 Arithmetic equality, element conditions 2-89 Arithmetic expressions 1-26 blanks in 1-25, 1-39 combining 1-26 comparing 1-30 data-mapped variables 1-204, 1-207 increment cell counts using 2-27 missing values in 1-173 mixing integers and reals 1-27 multicodes in 1-25 numb 1-28 order of evaluation 1-26 random 1-29 saving value of 1-97 Arithmetic values, storing 1-95 Arrays checking boundaries for assignments 1-112 referring to cells in 1-18, 1-197 triangular of statistics 3-71 types of 1-17 ASCII character set, octal punch code file 4-171 ASCII characters, punch code equivalents 4-175 Assignment 1-89 and 1-100 checking array boundaries for 1-112 copying codes 1-90 data-mapped variables 1-204, 1-207 missing values 1-173 or 1-100 replacing codes 1-92 storing arithmetic values 1-95 xor 1-101 Association, test for 3-76 Asterisks in tables 1-16 Audio files 4-74 availang, available languages file 4-84 Averages 2-137 creating with manipulation 3-33 exclude elements from 2-116 ax files 4-94 axcount, count records by axis name 2-25, 2-32
Index / 305
Quantum User’s Guide Volume 2
Axes analysis level 2-40, 3-53 bases in 2-56, 2-113 blank lines in 2-58 column and code map for 1-226 column width 2-41, 2-113 column, nested subheadings in 2-63 creation of, in Quanvert (Windows) 4-96 creation of, in Quanvert Text 4-83, 4-96 declare weighting in 3-14 defining for Quanvert 4-68, 4-69 double spacing in 2-41 elements per create in Quanvert Text 4-83 flag as single coded 2-44 generated from qdi file 1-221 grids 2-238 introduction to 2-39 long element texts in 2-66 maximum characters per axis 4-9 maximum per run 4-9 mutually exclusive elements 3-72 naming 2-39, 4-15 naming of files 4-15, 4-95 no double spacing in 2-45 no sorting 2-45 on tab statements 2-171 reflip incorrect 4-98 require single coding 2-40 reset flags between trailer cards 2-41 restrict access to, in Quanvert Text 4-84 sorting 2-44 special characters for laser printing 3-199 subaxes within 2-76 subheadings 2-41 axes.inf files 4-94 axes=, maximum number of axes per run 4-9 Axis names, table titles from 2-10 Axis subgroups 2-76 Axis-level statistics, list of 3-68 axreq=, axis coding requirements 2-25, 2-40 axtt, table titles using axis names 2-10, 2-32
B b, breakdown element for manipulation 3-41 baft, print base titles last 2-10 Banners see Breakdowns Base creating 2-56, 2-113 effective 2-119, 2-153, 3-147 enclose in parentheses 2-81 flag cells with small for stats 2-20 force export to SAS or SPSS 2-114 minimum effective for T statistics 2-29, 3-150 percentage against redefined 2-16 print base title last 2-10
306 / Index
Base (continued) redefining 2-103 required for statistics 3-71 small for special T statistics 2-20, 3-150 sort on element other than 3-126 suppress elements with small 2-21 suppress percentages with small 2-196 suppress statistics with small 2-196 suppress tables with small 2-21 use to define segments in an axis 3-69 base, base element 2-113 binasc.dat, octal punch codes for ASCII character set 4-171 bineas.dat, octal punch codes for extended ASCII character set 4-171 bintab, convert extended ASCII character set 4-174 bintab.qt, characters in extended ASCII character set 4-171 bit arguments per fld statement 2-267, 4-133 bit files 4-94 bit, elements with numeric codes 2-97 inc= with 2-99 when better than fld 2-99 Blank lines after column headings 2-14, 2-162 before column headings 2-14, 2-162 in tables 2-58 Blanks allowing in arithmetic tests 1-39 with col 2-84 bot, titles at bottom of page 2-210 Quanvert 4-71 with flt 2-218 with hitch/squeeze 2-191 boxe, end of box 3-207 Boxes in tables 3-206 boxg, box above G texts 3-207 boxl, draw line inside box 3-207 boxs, start of box 3-207 Brackets, print multicodes in 1-80 Break points, define in element texts 2-163, 3-199 Breakdowns, example of 2-167 btx files 4-94 byrows, export grids row-by-row in Quanvert 2-40, 2-249
C #c, start C code 1-183, 3-123 C array columns 1-18 defining size of 1-198 increasing 1-196 C code in Quantum spec 3-123 C compiler error messages 296, 4-162 C library functions, calling 1-192
Quantum User’s Guide Volume 2
C subroutine code file 4-11 compiled 4-22 c=+, net cases counted so far 2-48 example of 2-134 with the effective base 2-153, 3-147 c=, conditions 2-26, 2-40, 2-46, 2-119 data-mapped variables 1-213 with weights 3-13 c=-, count cases not counted so far 2-48 with the effective base 2-153, 3-147 ca, cancel online edit 1-167 Calculation of effective base 3-147 call, run a subroutine 1-177 passing variables with 1-190 cancel, cancel the run 1-128 cann, symbolic parameters for columns 2-228 Card type alphanumeric 1-58 highest 1-57, 1-198, 3-47 ignoring when reading data 1-49 location of 1-55, 3-47, 4-2 repeated 1-56 required 1-56 card_count, number of cards read so far 1-52 Cards first in record read 1-51 last in file read 1-52 last in record read 1-51 maximum per record with levels 4-2 more than 100 columns in multicard records 1-63 number read so far 1-52 read in during current read 1-50 read in for current record 1-50 cards=, defining levels 3-46, 4-2 Cell counts cancel incremental values for 2-45 file 4-22 incremental values for 2-42, 2-120 celllev=, update table at higher level than axes 2-174, 3-54 comparison with uplev 3-58 example of 3-58 statistics with 3-61 with grids 2-246 Center tables on page 2-22 Change record length using len= 1-78 Changes, before and after, test for 3-83 Character set 1-7, 4-169, 4-171 Characters allowed in variable names 1-195 Characters in extended ASCII character set 4-171 Characters per axis, set maximum 4-9 check_, possible syntax errors are fatal 1-10 chi1, one dimensional chi-squared test 3-74 chi2, two dimensional chi-squared test 3-76 chis, single class chi-squared test 3-78
Chi-squared test one dimensional 3-73 example of 3-74 formula 3-89 single classification 3-78 example of 3-80 formula 3-90 two dimensional 3-76 example of 3-77 formula 3-89 Clean data file 1-228, 4-16 clean.q, clean data file 1-228, 4-16 clear, reset variables to initial state 1-111 advantages over assignment 1-111 clear=, reset axis cells 2-41, 3-64 clevel confidence level for special T stats 2-26, 3-156 test for significance with chi-squared test 3-78 Codes / with 1-15 adding into columns 1-102 checking exclusive 1-150 checking number in column 1-154 checking type of 1-146 checking with require 1-144, 1-148 comparing 1-31 copying 1-90 counting, in columns 1-28 deleting 1-103 entering 1-14 list of 1-13 replacing 1-92 set random into columns 1-107 symbolic parameters for 2-232 Coding, defining axis requirements 2-25 Coding, summarizing for axes 2-25 col, basic count elements 2-83 blanks with 2-84 conditions 2-86 semicolons in text 2-85 text-only elements 2-88 col, column element 2-115, 2-140 colmap, column/code map for axes 1-226, 4-16 colrep, check column and code usage 4-27 coltxt, print text in main body of table 2-61 Column and code map for axes 1-226, 4-16 Column and code usage, check 4-27 Column headings 2-159 blank lines after 2-14, 2-162 blank lines before 2-14, 2-162 defining for Quanvert 4-71 in laser printed tables 3-199 line titles up with start of 2-204 splitting long texts 2-163 suppress with squeeze=2 2-193 text differs from row text 2-118 underlining 3-203 using colwid= 2-164
Index / 307
Quantum User’s Guide Volume 2
Column headings (continued) using pagwid and side= only 2-160 with g and p statements 2-164 with sid 2-181 Column offsets with added tables 2-183 Column percentages 2-16 example of 2-57 force to round to 100% 2-19 suppress small 2-21 Columns 1 to 100 1-52 checking contents of 1-34 checking with require 1-144 delete codes from 1-103 fields of 1-18 insert codes in 1-102 listing contents of 1-139 real numbers in 1-23 referring to 1-18 resetting to blank 1-52 set random code into 1-107 spare, using 1-52 symbolic parameters for 2-228 Columns in tables Newman-Keuls test 3-165 position of subheadings above 2-65 ranks 2-16 sorting 2-10, 3-127 suppress small 2-20 t-test on means 3-164 t-test on proportions 3-160 vertical lines between 2-167 width 2-10, 2-41, 2-113, 2-164 colwid=, column width 2-10, 2-41, 2-113, 2-164 Combine several variables on one statement 1-214 Combining tables 2-179, 2-188 Combining testing sentences 1-157 Comma-delimited ASCII, Quantum/Quanvert Text tables into 4-32, 4-35 Command availability for Quanvert Text 4-83 comment, comment statement 1-9 Comments with require 1-147 Comparing data variables 1-31 Compilation listing file 1-226, 4-13 Compilation, files created by 1-226 Compiled C subroutine code file 4-22 Compiler error messages 271, 4-137 Compiling your program file 1-226 Components of a program 1-3 Compressed data files, reading 1-225 Conditions c=+ and c=- 2-48, 2-153, 3-147 count cases not counted so far 2-48 net cases counted so far 2-48 on elements 2-46, 2-52, 2-119 Quanvert axes 4-69 ranges 2-92 simplifying complex 2-52
308 / Index
Conditions (continued) types of 2-48 with c= 2-26, 2-46 with col statements 2-86 Confidence level for special T stats 3-156 Constants comparing 1-31 individual 1-13 strings 1-15 Continuation elements in sorted tables 3-137 long element texts 2-66 long statements 1-9 continue, read next statement 1-119 Continuity correction for t-test 3-161 Copying weights into the data 3-24 Correcting data forced edits 1-159 methods of 1-159 online 1-160 split 1-161 write 1-161 Corrections file 1-170, 4-4 corrfile, corrections file 4-4 count, create a holecount 1-135 crd=, card type location 1-55, 3-47, 4-2 Create new data files split 1-167 write 1-69 Creating a table of contents 3-189 Creating new cards 1-70 Cross-referencing in panel studies 4-73 csort, sort columns 2-10, 3-127 Cumulative output summary file 4-22 Cumulative percentages 2-16 example of 2-34 Currency symbols, print next to absolutes 2-81 Customized text file, define 4-8 C-variables 1-18
D d, delete codes in online edit 1-163 Data automatic filtering of in Quanvert Text 4-84 C array 1-18 checking and verifying 1-4 compressed, reading 1-225 convert to Quanvert database 4-93 convert to SAS format 4-56, 4-65 convert to SPSS format 4-38, 4-44 converting multicoded to single coded 1-181 correcting 1-159 counting responses with numeric codes 1-108 define structure in levels file 3-47 merging cards from different files 1-59
Quantum User’s Guide Volume 2
Data (continued) merging fields from an external file 1-61 merging files 4-4 non-standard format 1-63, 1-225, 2-250 output file for require 4-18 overlapping, with special T stats 2-30, 3-159 Quantum format 4-167 reading into C array 1-48 types of 1-47 write out fixed length records 1-69, 1-73 write out in user-defined format 1-84 Data files #include with 2-227 define T variables in 1-113 non-standard 1-63, 1-225, 2-250 Databases access Unix with PC-NFS 4-130 add variables to 4-99 convert unpacked files 4-130 copy packed 4-125 create 4-93 do not compress 4-124 files 4-94 icon 4-90 join split for unpacking 4-127 levels 4-72, 4-73 link similar 4-101 make secure 4-116 maximum size of packed file 4-124 new format 4-67 old format 4-67 pack and split 4-124, 4-129 Quanvert (Windows) 4-86 security level 4-117 split large packed 4-127 store variables in subdirectories 4-80 transfer format 4-125 transfer programs for 4-125 unknown file formats 4-128 unpack 4-126 weighted 4-71 see also Quanvert, Quanvert Text, Quanvert (Windows), Multiproject databases Data-mapped variables 1-201 assigning values to 1-207 defining 1-203 testing values of 1-211 using in analysis specifications 1-213 Data-mapping files 1-201, 1-203 Datapass error messages 297, 4-163 Datapass error summary file 4-18 Datapass program 1-227 date, print date on table 2-10, 2-32 db.ico file for Quanvert (Windows) 4-90 db.nts file for Quanvert (Windows) 4-90 db.ptf, translation file 2-176, 4-23, 4-77 dbhelp.msg file for Quanvert (Windows) 4-90 debug, intermediate figures for special T stats 3-157
dec=, decimal places for absolutes 2-10, 2-113 with means 2-139 with stat= 3-68 Decimal places 1-16 absolutes 2-10, 2-113 in significance levels 3-68, 3-71 in statistics 3-68, 3-71 means 2-139 percentages 2-11, 2-113 decp=, decimal places for percentages 2-11, 2-113 with stat= 3-68 #def, global values for symbolic parameters 2-237 with grids 2-243 *def see #def Default options file 2-32, 4-3 definelist, name a list 1-44 limits 4-9 delete, delete codes from columns 1-103 descrips.inf 4-24, 4-94 Descriptive statistics, exclude elements from 2-116 di, display columns in online edit 1-162 Difference between .eq. and = 1-37 Differences between celllev and uplev 3-58 Digits in variable names 1-195 Dirty data file 1-228, 4-16 dirty.q, dirty data file 1-228, 4-16 Disk space check machine has enough for job 4-177 reduce amount needed for Quanvert 4-75 temporary required during run 4-178 Display wide files in Quanvert Text 4-85 Distribution, comparing 3-76, 3-81 div, divide one table by another 2-186 Division 1-26 DNA, missing values in Quanvert 4-74 do, start a loop 1-119 nested loops 1-123 with individual values 1-120 with ranges of values 1-121 Dollar signs with strings 1-15 Don’t know, data-mapped variables 1-205 Double precision calculations 2-27, 2-32 Double quotes, in holecount/list headings 1-135, 1-140 dp, double precision calculations 2-27, 2-32 dsp, double spacing 2-11, 2-32, 2-41, 2-113 Dummy axis, name in Quanvert Text 4-84 Dummy elements 2-113 with add 2-186 dummy, create a dummy element 2-113, 2-186
E e, insert codes in online edit 1-163, 3-124 #ed, start edit in tab section 3-124 ed, re-edit current record online 1-166
Index / 309
Quantum User’s Guide Volume 2
ed, start of edit section 1-8 with levels 3-50 edheap=, limit for edit statement 4-9 Edit, processing missing values 1-172 Editing axis coding requirements 2-25 in tabulation section 3-124 interactive correction of errors 1-160 with levels 3-50 effbase, effective base 2-119, 2-153, 3-147, 3-149 Effective base 2-119, 2-153, 3-147, 3-149 Element texts define breakpoints in 2-163 printing | and ! in 3-202 Elements all zero, ignoring 2-116 assign to subgroups 2-79, 2-114 base 2-56, 2-57 non-printing 2-57 basic counts 2-50 non-printing 2-56 required for statistics 3-71 blank lines 2-58 cases already counted 2-48 cases not yet counted 2-48 conditions on 2-46, 2-52 count creating 2-49 distribution of records between 2-129 excluding from totals 2-116 extra text 2-58 ignore in column axes 2-115 ignore in higher dimensions 2-115 ignore in row axes 2-116 indent text when split 2-115 intermediate figures for special T stats 3-157 maximum values of inc= 2-124 minimum values of inc= 2-124 number per create in Quanvert Text 4-83 percentage differences 2-124 print all-zero 2-45 rejecting one from another 2-125 reprint at top of continued tables 2-109 responses with numeric codes 2-94, 2-97 selecting for special T stats 3-145 set maximum per run 4-9 simplifying complex conditions 2-52 splitting long texts 2-51 subheadings 2-62 sum of suppressed 2-118 suppress all-zero 2-15, 2-44 suppressed, accumulating in tables of nets 2-72 text continuation 2-66 types of 2-45 underlining text on 2-119 unsorted, in sorted table 2-116 weight factors for 3-15 weighted target for 3-14 elms=, elements for special t-tests 3-155
310 / Index
elms=, maximum number of elements per axis 4-9 else, conditional actions 1-117 emit, insert codes in columns 1-102 #end, finish edit in tab section 3-124 #endc, end C code 1-183, 3-123 End of data file, checking for 1-52 end, end of edit section 1-8 endlevel, edit at end of level 3-51 endnet, end a net 2-67, 2-113 #endpostscript, end PostScript code 3-213 endsort, end secondary level sorting 2-113, 3-134 terminating more than one level 3-135 Environment variables QTAXES 4-10 QTEDHEAP 4-10 QTELMS 4-10 QTFORM 3-201 QTHEAP 4-10 QTHOME 1-223 QTINCHEAP 4-10 QTINCS 4-10 QTINLISTHEAP 4-10 QTLEXCHARS 4-10 QTMANIPHEAP 4-10 QTNAMEVARS 4-10 QTNOPAGE 4-23 QTNOWARN 4-11 QTSPSSRC 4-55 QTTEXTDEFS 4-10 .eq., logical equality 1-30 Error messages accum stage 297, 4-163 C compilation stage 296, 4-162 compilation stage 271, 4-137 datapass stage 297, 4-163 include files 2-226 percentiles 2-151 printing on the screen 1-11 Error variance of the mean 2-136 formula 2-157 in weighted jobs 2-143 suppress if has small base 2-20 suppress if small base 2-196 Errors, correcting 1-5, 1-10, 1-170 errprint, print error messages on the screen 1-11 ex, table manipulation 3-34 ex=, manipulation expression 2-119, 3-26, 3-32 secure databases 2-45, 2-118, 4-116, 4-118 Examining records count 1-133 list 1-138 online edit 1-160 qfprnt 1-84 report 1-70 require 1-145 write 1-65
Quantum User’s Guide Volume 2
Examples aided and unaided awareness 2-230 anlev= 3-53 brand awareness questions 2-52 breakdown 2-167 c=+ 2-134 chi-squared test 3-74 column percentages 2-57 cumulative percentages 2-34 data-mapped variables 1-201, 1-213, 1-215 div 2-187 editing with levels 3-51 Friedman’s test 3-87 grids 2-239, 2-240, 2-241 hitch/squeeze 2-191 indices 2-35 Kolmogorov-Smirnov test 3-82 manipulation 3-40, 3-42 maxim and minim 2-37 McNemar’s test for differences 3-84 multidimensional tables 2-172 Newman-Keuls test 3-113 one sample T-test 3-102 one sample Z-test 3-94 one-way analysis of variance 3-110 paired T-test 3-102 percentaging against redefined base 2-103 percentaging with nets 2-73 process 1-130, 2-100 product tests 2-247 smbase= 2-199 subtotals 2-136 suppress percents with small bases 2-199 symbolic parameters 2-229, 2-232 table of means 2-36 table with inc= 2-136 total percentages 2-33 total rows in tables 2-121 totals 2-136 Exclude respondents from weighting 3-6 exp, exponentiation manipulation operator 3-27 explode, convert multicoded data to single coded 1-181 export, export element to SAS or SPSS 2-114 Exporting data, suppressing elements 2-115 exportmp, force an axis to be multicoded when exporting to SPSS 2-41, 4-50 Expressions arithmetic 1-25 combining arithmetic 1-26 combining logical 1-39 comparing data variables 1-31 comparing values 1-30 logical 1-30 manipulation 3-26 mixed mode arithmetic in 1-27 mixing logical operators 1-41 numb 1-28
Expressions (continued) random 1-29 range 1-38 with table manipulation 3-34 Extended ASCII character set defining 4-169 laser printed tables 3-212 octal punch code file 4-171 External data file, merge a field from 1-61 External variables 1-199 with subroutines 1-186
F F and T values with nft 3-108 formula 3-117 fac=, factors for statistics 2-119, 2-138 in same axis as inc= 2-139 on col and val 2-120 on row elements, for T-test 3-101 percentiles 2-144, 2-145 with stat= 3-93 Factor weighting 3-2, 3-7 factor, factor weighting 3-7 Factors decrementing by a constant 2-120 defining 2-119 incrementing by a constant 2-120 on col and val 2-120 percentiles from 2-144, 2-145, 2-146, 2-148 reverse sequential order for percentiles 2-146 scaling 2-117 switching off 2-120 failed_, action when require fails 1-156 fen, font encoding files 3-212 fetch, load data from a look-up file 1-178 fetchx, load data from a look-up file 1-180 field, count numeric codes across fields 1-108 fieldadd, count numeric codes 1-111 Fields checking codes in 1-37 comparing 1-35 copying codes into 1-91 merging from an external file 1-61 referring to 1-18 figbracket, print characters around absolutes 2-41, 2-81, 2-114 figchar=, character to print next to absolutes 2-41, 2-81, 2-114 figpost, print character after absolutes 2-41, 2-81, 2-114 figpre, print character before absolutes 2-41, 2-81, 2-114 File formats, unknown for databases 4-128 filedef, define output file type 1-78 override ruler printing with ident 1-83
Index / 311
Quantum User’s Guide Volume 2
Files aliases 4-6 alp 4-94 ax, axis information files 4-94 axes.inf 4-94 binasc.dat 4-171 bineas.dat 4-171 bintab.qt 4-171 bit 4-94 btx 4-94 C subroutine code 4-11 cell counts 3-38, 4-22 clean data 1-167, 4-16 column and code map 1-226, 4-16 comm.qsp 4-44 commands 4-65 commands.qsp 4-51 compilation listing 1-226, 4-13 compiled C subroutine code 4-22 compiled subroutines 1-183 compressed data 1-225 corrections 1-170, 4-4 created at compilation stage 1-226 created by flip 4-94 cumulative output summary 1-230, 4-22 customized table texts 4-7 data merge file 4-4 data.qsp 4-44, 4-51 data-mapping 1-201, 1-203 datapass error summary 4-18 default options 2-32, 4-3 deletion of temporary 1-223 descrips.inf 4-24, 4-94 dirty data 1-167, 4-16 fen 3-212 fli, inverted data files 4-94 flip.cnf 4-78 format file for table of contents 3-194 frequency distribution 4-17 generated by qdiaxes 1-220 graphics output 4-22 holecount 4-17 inc 4-94 intermediate figures for special T stats 3-157 levels 3-45, 4-2, 4-94 log 1-230 machine.def 4-128 manipulated cell counts 3-38 merges 4-4 merging data from different files 1-59 mul 4-75, 4-94 nums 1-229 nums.man 1-229 output data from require 4-18 PostScript 3-198 private.c 4-11 private.o 4-22 ptf, translation file 2-176, 4-23, 4-77
312 / Index
Files (continued) qdi 1-201, 1-217 Quanvert levels cross-reference 4-95 numdir.qv 4-80 required for 4-96 tstatdebug 4-76 Quanvert (Windows) 4-86 db.ico 4-90 db.nts 4-90 dbhlp.msg 4-90 qextras file 4-91 qnaire.txt 4-91 sound files 4-74 stats.ini 4-86 Quanvert Text 4-81 access rights 4-81 availang 4-84 foreign language prompts 4-81 mfwaves 4-111 profopts 4-82, 4-85 qotext.dat 4-82 qvtext.dat 4-82 users 4-83 records written by write/require 1-145, 4-17 rim weighting parameters 4-5 run definitions 3-38, 4-3 statdata 4-65 subroutine source 1-183 table of contents format 3-190 tables 1-230, 4-22 texts.qt 4-8 user-defined limits 4-9 variables 1-196, 4-1 weighting report 1-229, 4-19 Filtered holecounts 1-136 Filters canceling 2-219 groups of tables 2-217 in grid tables 2-247 n00 in axis 2-104 named 2-11, 2-220 nested sections 2-221 on per-user basis in Quanvert Text 4-84 Quanvert 4-71 sample program 2-219 firstread, first card in record read 1-51, 3-64 Fixed length records, writing out 1-69, 1-73 fld, elements with numeric codes 2-94 bit argument limit 2-267, 4-133 options on 2-112 when to use bit instead 2-99 fli files 4-94 Flip, create Quanvert database 4-68, 4-93 configuration file 4-78 files created by 4-94 reasons axes excluded 4-69 remove files used by 4-97
Quantum User’s Guide Volume 2
Flip, create Quanvert database (continued) reserved words 4-70 flip.cnf, flip configuration file 4-78 flipclean, remove files used by flip 4-97 flt, filter groups of tables 2-217 and with 2-218 bot with 2-218 foot with 2-218 inc= with in levels jobs 2-218 options on 2-9, 2-217 tt with 2-218 flt=, named filters 2-11, 2-220 flush, percentages flush with absolutes 2-11, 2-32 Font encoding in PostScript tables 3-212 font=, fonts for laser printing 2-11, 3-209 Fonts for titles 3-205 in laser printed tables 3-197, 3-209 #fonttable, define fonts for table 3-209 foot, footnotes on tables 2-208 switching off 2-209 with flt 2-218 with hitch/squeeze 2-191 Footnotes on tables 2-208 overlapping data 2-15, 3-160 switching off 2-15, 2-209 with flt 2-218 with hitch/squeeze 2-191 Forced editing with if 1-159 with require 1-151 Forcing single-coded answers 1-104 Format file for table of contents 3-190 naming 3-194 Formulae analysis of variance 3-119 chi-squared test one dimensional 3-89 single classification 3-90 two dimensional 3-89 error (sample) variance 2-157 F and T values from nft 3-117 Friedman’s test 3-91 Kolmogorov-Smirnov test 3-90 least significant difference test 3-182 McNemar’s test for differences 3-91 mean 2-156 Newman-Keuls test 3-121, 3-184 one-way analysis of variance 3-119 paired preference test 3-181 rim weighting efficiency 4-21 root mean square 4-20 significant net difference test 3-181 standard deviation 2-156 standard error 2-157 sum of factors 2-156 T-test on column means 3-177
Formulae (continued) on column proportions 3-179 one sample 3-117 paired 3-117 two sample 3-117 Z-test one sample 3-115 overlapping samples 3-116 subsample proportions 3-116 two sample on proportions 3-115 Frequency distribution file 4-17 Frequency distributions 1-138 alphabetic 1-139 double quotes in headings 1-140 missing values in 1-139 multiplied 1-142 ranked 1-139 weighted 1-142 friedman, two-way analysis of variance 3-85 Friedman’s test 3-85 example of 3-87 formula 3-91 F-test see Analysis of variance, one-way, ANOVA Functions, C library 1-192
G g, layout column headings 2-165 combining groups of 2-166 in laser printed tables 3-199 sid statements with 2-181 spacing with 2-166 .ge., greater than or equal to 1-30 Generate Quantum spec from qdi file 1-217 go to, routing in edit section 1-118 graph=, create graphics input files 2-13, 2-32 files created by 4-22 Grid axes see Grids Grid tables see Grids grid, identify a grid table 2-244 Grids #def with 2-243 components of 2-238 creating tables 2-244 data-mapped variables 1-215 example of 2-241 code symbolic parameters 2-240 column and code symbolic parameters 2-240 column symbolic parameters 2-239 export to SAS/SPSS from Quanvert 2-40, 2-249 filtered columns in 2-247 in levels jobs 2-245 increments in 2-243 inctext= invalid with 2-123
Index / 313
Quantum User’s Guide Volume 2
Grids (continued) recognizing 2-238 rotated, op= with 2-245 weighted 2-246 group=, axis group for element 2-79, 2-114 groupbeg, start of subaxis 2-77 groupend, end of subaxis 2-77 Groups in Quanvert (Windows) 4-68 .gt., greater than 1-30
H Harvard Graphics 4-32 hct_, holecount file 1-228, 4-17 hd=, axis subheading 2-41 hdlev=, nested subheadings for column axes 2-63 hdpos=, position of subheadings above columns 2-65 header=, header length in non-std data file 2-250 heap=, maximum number of characters per axis 4-9 Hierarchical data process with 3-63 processing with clear= 3-64 processing with levels 3-45 see also Levels Highest card type 1-57, 1-198, 3-47, 4-2 hitch=, print table on same page as previous table 2-13, 2-188 how Quantum compares table texts 2-194 numbering printed pages 2-19 paper saving mode 2-191 paste one table under another 2-195 print page numbers logically/physically 2-196 short tables with 2-190 table texts with 2-191 hold=, rows to reprint at top of continued tables 2-109, 2-114 Holecount file 4-17 Holecounts 1-133 basic 1-135 double quotes in headings 1-135 filtered 1-136 multiplied 1-136 weighted 1-136 hug=, space required at bottom of page 2-108
I Icons for Quanvert (Windows) 4-90 ID text, and data-mapped variables 1-209 –id, multiple runs in a directory 1-231 id=, manipulation id 2-115, 2-174, 3-36, 3-41 on n/col/val/fld/bit 3-28
314 / Index
ident, default print parameters for write 1-81 print/suppress ruler with 1-83 turn off defaults 1-83 Identical statements, filing and retrieving 2-225 IDs for manipulation 2-115 if, conditional actions 1-115 forced editing with 1-159 with missingincs 1-173 with require 1-157 ignorezeros, with n07 2-137 .in., comparing values to a list 1-42 inc files 4-94 inc(), increments in grids 2-243 inc=, increment for cell counts 2-27, 2-32, 2-42, 2-120 data-mapped variables 1-205 element for maximum values of 2-124 element for median values of 2-124 element for minimum values of 2-124 example of 2-121 exclude missing values from calculations 2-142 in grids 2-243 in same axis as fac= 2-139 missing values with 2-122 on flt in levels jobs 2-218 on n25, for T-test 3-101 percentiles 2-144, 2-149 Quanvert databases 4-78 sample table with 2-136 switching off 2-122 table of maximum values of 2-28 table of mean values of 2-28 table of minimum values of 2-29 with levels 3-59 with statistics 2-138 incheap=, number of characters for inc= names 4-9 #include, read contents of another file 2-226 symbolic parameters with 2-228, 2-234 *include see #include Include files compressed 1-225 nesting 2-227 #includes, read non-standard data file 2-250 Incorrect axes, reflipping 4-98 Increasing limit for element manipulation 4-9 limit for text strings 4-10 maximum complexity of edit statement 4-9 maximum size of definelist 4-9 number of axes per run 4-9 number of characters for inc= names 4-9 number of characters per axis 4-9 number of elements per axis 4-9 number of inc= per run 4-9 number of named variables per run 4-9 number of text symbolic parameters 4-9 size of C array 1-196 incs=, maximum number of inc= per run 4-9
Quantum User’s Guide Volume 2 inctext=, text for numeric variable 2-27, 2-42, 2-123 indent=, indent folded element text 2-13, 2-115 Indices 2-16 example of 2-35 Individual constants 1-13 inline, convert to inline code 1-45 inlistheap=, limit on complexity of a definelist 4-9 input, weighting with proportions 3-7, 3-16 Integer variables 1-20 reset to zero 1-111 Integers 1-16 and reals in the same expression 1-27 defining in subroutines 1-189 saving in real variables 1-96 Intermediate files, summary of 4-23 Internal variable names 4-15, 4-24, 4-94 Interpolation method for percentiles 2-28, 2-146, 2-151, 2-152 Inverted databases 4-93 ismissing, check for missing_ 1-175
J Jobs check whether sufficient disk space to run 4-177 compile only 1-226 complete run 1-224 create log file 1-230 create Quanvert database 4-93 creating tables 1-229 deletion of temporary files 1-223 load C code 1-227 modifying for Quanvert 4-68 multiple runs in a directory 1-231 read and process data 1-228 rerun compilation & output stages only 1-229 run in background 1-230 speeding up 1-45 stages in 1-223 temporary space for 4-178 Join split databases 4-125 Jumping to tab section 1-126 Justification column headings in laser printed tables 3-199 row text in laser printed tables 3-203
K keep, percentage differences 2-123, 2-126, 2-175 Kolmogorov-Smirnov test 3-81 formulae 3-90 ks, Kolmogorov-Smirnov test 3-81
L l, name an axis 2-40 Labels 1-4 with do 1-119 with go to 1-118 lang=, specify the language 2-13, 2-176, 4-77 Languages Quanvert (Windows) 4-77 Quanvert Text 4-81, 4-84 SAS 4-56, 4-64 specify 2-13, 2-176 SPSS 4-38, 4-44, 4-54 tables 2-176 Large numbers, printing 2-27 Laser printed tables fonts for 2-11 justification of column headings 3-199 justification of row text 3-203 personalized PostScript code 3-213 printing extended ASCII characters in 3-212 special characters with 3-201 suppressing border 3-206 lastread, last card in record read 1-51, 3-65 lastrec, last record in file read 1-52 .le., less than or equal to 1-30 Least significant difference test 3-175 formula 3-182 len=, change the record length 1-78 levbase, increment base at anlev=level 2-124, 3-57 level, edit for a specific level 3-50 Levels analysis level for tables 2-10 cross-reference files for Quanvert 4-94, 4-95 cross-tabulating axes at different levels 3-53 define data structure in level file 3-47 defining in levels file 3-45, 4-2 defining with struct 3-48 example of edit 3-51 grids with 2-245 how tables are produced 3-51 inc= on flt statements 2-218 introduction to 3-45 levels file 3-45 maximum allowed 3-45 maximum cards per record 4-2 maximum sub-records per record 3-48 naming in edit section 3-50 numeric variables 3-59 preparing for Quanvert 4-72, 4-73 process with 3-63 record length 3-48 special T statistics 3-62, 3-149, 4-88 statistics with 3-61 updating bases in uplev= tables 2-124, 3-57 updating cells with anlev= 3-53 updating tables at higher level than axes 3-54 weighting 3-12
Index / 315
Quantum User’s Guide Volume 2
Levels file 4-2 lexchars=, increase limit for text strings 4-10 License expiry warning 4-11 Limits increasing 4-9 list of 2-265, 4-131 numbers 1-16 linesaft, blank lines after column headings 2-14, 2-162 linesbef, blank lines before column headings 2-14, 2-162 list, create frequency distribution 1-139 lista, alphabetic frequency distribution 1-139 listr, ranked frequency distribution 1-139 Lists alphabetic 1-139 creating 1-139 named 1-44 preventing use of in Quanvert Text 4-85 ranked 1-139 Local variables 1-199 with subroutines 1-186 Location, test for in matched samples 3-85 Log files 1-230 Logical expressions arithmetic value of field 1-38 checking equivalence of 1-154 combining 1-39 comparing data variables 1-31 comparing values 1-30 comparing variables to a list 1-42 data-mapped variables 1-205, 1-210 negating 1-40 range 1-38 validating 1-153 with c= 2-119 with if 1-115 Logos, printing on tables 3-209 Long texts, splitting 2-51 Look-up files 1-178 list used/unused keys 1-180 Loops function of 1-119 nesting 1-123 with routing 1-124 Lotus-123, convert Quantum data for use with 4-32 lsd, least significant difference test 3-175 lst_, frequency distribution file 1-228, 4-17 .lt., less than 1-30
M m, create a manipulated row 3-25 define manipulation expression 3-26 options on 3-25 machine.def, qvpack/qvtrans alias file 4-128
316 / Index
manipclean, delete all except manipulation files 4-25 manipheap=, limit for element manipulation 4-9 Manipulated cell counts file 3-38, 4-22 Manipulated elements, in sorted tables 3-141 Manipulation apply spechar and nz options to manipulated elements 2-14, 3-31 averages 3-33 example of 3-40, 3-42 expressions with 3-41 manipulated cell counts file 3-38 more than one table 3-39 on n statements 3-32 parts of tables 3-41 program 1-229 replacing numbers in tables 3-35 row, example of 3-30 run definitions file 3-38, 4-3 run ids for 3-38 tables from dummy data 3-43 tables from other runs 3-38 using automatic table ids 3-36 using element ids 3-28 using overall position 3-37 using previously manipulated figures 3-38 using relative position 3-29, 3-37 using row texts 3-27 using your own ids 3-36 whole tables 3-34 manipz, apply spechar and nz options to manipulated elements 2-14, 3-31 mapvar, define data-mapped variable 1-203 Matched samples, testing difference in location 3-85 max, maximum manipulation operator 3-26 max=, highest card type 1-57, 1-198, 3-47, 4-2 maxim, maximum values of inc= 2-28, 2-124 example of use 2-37 maxima.qt, limits file 4-10 maxsub=, maximum sub-records per record in levels data 3-48, 4-2 maxwt=, maximum weight 3-8 mcnemar, McNemar’s test for differences 3-83 McNemar’s test for differences 3-83 formula 3-91 mean, t-test on column means 3-164 Means analysis levels with 3-61 decimal places with 2-139 error variance 2-136 formula 2-156 least significant difference test 3-175 print maximum values of 2-37 print minimum values of 2-37 produced by list 1-139 sorted table of 3-141 standard deviation 2-136 standard error 2-136 suppress if have small base 2-20, 2-196
Quantum User’s Guide Volume 2
Means (continued) table of means 2-28, 2-36 test difference between 3-110, 3-112, 3-165 test for specific values 3-101 test paired differences between 3-101 t-test on column 3-164 two sample T-test for comparing 3-105 with fac= 2-140 with inc= 2-142 median, median values of inc= 2-124 Medians, see percentiles medint=, interpolation method for percentiles 2-28, 2-151, 2-152 mergedata, merge data from an external file 1-61 merges file 1-59, 4-4 mflip program 4-107 mfwaves file 4-111 min, minimum manipulation operator 3-26 minbase=, very small base for T stats 2-29, 3-150, 3-151 minim, minimum values of inc= 2-29, 2-124 example of use 2-37 Minimum weight, defining 3-8, 3-18 minwt=, minimum weight 3-8 Missing values assignments 1-173 checking for 1-175 counting with val 2-94 exporting as missing_ 2-124 in arithmetic expressions 1-173 in frequency distribution 1-139 processing in the edit 1-172 Quanvert 4-74 switch on/off in edit 1-172 switch processing on/off in tab section 2-29, 2-32 treat other values as 2-30, 2-42, 2-124 when found 1-172 with inc= 2-122 with n25;inc= 2-142 with pre/postweights 3-8 missing=, treat other values as missing 2-30, 2-42, 2-124 missing_, missing values 1-173, 1-174 missingincs, switch missing values processing on/off 1-172, 2-29, 2-32 with if 1-173 missingval, export missing data as missing_ 2-124 mul files 4-75, 4-94 Multicard records definition of 1-47 more than 100 columns per card 1-63 reading 1-49 writing 1-66 Multicodes convert to single codes 1-181 entering 1-14 printing 1-80
Multidimensional tables, example of 2-172 Multilingual surveys 2-13, 2-176 Quanvert (Windows) 4-77 Multiplication 1-26 Multiproject databases 4-101 add new variables to 4-107 axes with duplicate element texts 4-103 command file for 4-110 create in Quanvert (Windows) 4-101 create in Quanvert Text 4-101, 4-107 how common axes are combined 4-102 merging components 4-107 select projects from 4-111 things to check 4-106 Mutually exclusive elements in axes 3-72
N n statements, options on 2-112 n00, filtering within an axis 2-104 example of use 2-241 with n04 and n05 2-134 with redefined base 2-103 n01, basic counts 2-50 percentiles with inc= 2-144, 2-149 n03, text only 2-58 n04, total 2-133, 2-134 example of 2-121 n05, subtotal 2-133, 2-134 n07, average 2-137 n09, start new page 2-108 n10, base 2-57 n11, base, non-printing 2-57 in Quanvert Text 4-85 n12, mean 2-140 analysis levels with 3-61 suppress if has small base 2-20, 2-196 with ANOVA 3-110 with T-tests 3-101 with two sample T-tests 3-105 n13, sum of factors 2-144 n15, basic counts, non-printing 2-56 n17, standard deviation 2-136 suppress if has small base 2-20, 2-196 with ANOVA 3-110 with T-tests 3-101 with two sample T-tests 3-105 n19, standard error of the mean 2-136 alternative formula for 2-143 calculate using weighted figures 2-31 suppress if has small base 2-20, 2-196 with ANOVA 3-110 with T-tests 3-101 with two sample T-tests 3-105 n20, error variance of the mean 2-136 suppress if has small base 2-20, 2-196
Index / 317
Quantum User’s Guide Volume 2
n23, subheading 2-62 n25, component values for means etc. 2-140 manipulating components of 3-30 print in column axes 2-115, 2-140 print in row axes 2-116, 2-140 Quanvert databases 4-76 n30, percentiles 2-144, 2-145 n31, effective base 2-136, 2-153, 3-147, 3-148 n33, text continuation 2-66 NA, missing values in Quanvert 4-74 Name, refer to data fields & responses by 1-201 Named filters 2-11, 2-220 prevent creation of, in Quanvert Text 4-83 Named lists 1-44 Named variables, increasing limits for 4-9 namedalpha, alpha variables 4-73 namedinc, numeric variables 4-42, 4-49, 4-63 Quanvert 4-70 namevars=, number of named variables per run 4-9 Naming of variable files 4-15, 4-95 Naming variables 1-195, 4-15 axes 2-39 for use in Quanvert 4-68 Naming weighting matrices 4-71 nand, force same table number for and tables 2-178, 2-211 ndi, distribute element cases across axis 2-129 .ne., not equal to 1-30 Nested filter sections 2-221 Nested subheadings in column axes 2-63 net, start a net 2-67 Nets accumulation of suppressed elements in 2-72 cases in previous elements 2-48 cases not yet counted 2-48 collecting suppressed elements 2-14, 2-43 description of 2-67 for previous lines 2-69 for subsequent lines 2-67 percentaging with 2-73 sorting by net level 2-14, 2-43, 2-70, 3-128, 3-129 example 3-129, 3-134 switching off 2-70 with totals 2-134 netsm, small suppression with nets 2-14, 2-32, 2-43 netsort, sort nets by net level 2-14, 2-32, 2-43, 2-70, 3-129 New cards, creating, example of 2-53 New page, starting 2-108 Newman-Keuls test 3-112, 3-113, 3-165 formula 3-121, 3-184 News file for Quanvert (Windows) 4-90 nft, F and T statistics 3-108 formula 3-117 nk, Newman-Keuls test 3-112 nkl, Newman-Keuls test 3-165 No response, data-mapped variables 1-206
318 / Index
noacr100, suppress 100% on base row 2-32 noaxcount, switch off axcount 2-32 noaxttl, suppress table headings 2-32 nobounds, switch off array bounds checking 1-112 nocheck_, possible syntax errors not fatal 1-10 nocol, not a column element 2-115, 2-116 Quanvert databases 4-75 nodate, suppress date 2-32 nodp, suppress double precision calculations 2-32 nodsp, no double spacing 2-32, 2-45 noexport, don’t export element to SAS or SPSS 2-115 noexportsp, force an axis to be multicoded when exporting to SPSS 4-50 nofac, no factors 2-120 noflush, percentages not flush with absolutes 2-32 nograph, suppress graphics 2-32 nohigh, not a higher dimension element 2-115 Quanvert databases 4-75 noident, switch off default write parameters 1-83 noignorezeros, switch off ignore zeros 2-137 noinc, suppress incremental values 2-32, 2-45, 2-122 nomanipz, turnoff manipz 3-31 nomissingincs, switch missing values processing off 2-32 nonetsm, no small suppression with nets 2-32 nonetsort, turn off sorting by net level 2-32, 2-70, 3-129 Non-identical statements, filing and retrieving 2-227 Non-standard data 1-63, 1-225, 2-250 nontot, exclude element from totals 2-116 nonz, print all-zero elements 2-45 nonzcol, print all-zero columns 2-32 nonzrow, print all-zero rows 2-32 nooverlapfoot, suppress overlap footnotes for T stats 2-15, 3-160 nopage, suppress page numbers 2-18, 2-32 #nopagebox, suppress border on laser printed tables 3-206 nopc, suppress percent signs 2-18, 2-32 noprint, suppress printing of tables 2-15 noround, element not force rounded 2-19, 2-32, 2-124 norow, not a row element 2-116 Quanvert databases 4-75 noscale, ignore scaling factor 2-32 nosmcol, print small columns 2-32 nosmrow, print small rows 2-32 nosmtot, print small totals 2-32 nosort, unsorted axis 2-45 nosort, unsorted element in sorted table 2-116, 3-129 nosort, unsorted table in sorted run 2-32 nosummary, keyword for secure databases 2-45, 4-119 .not., negate logical expressions 1-40
Quantum User’s Guide Volume 2
notauto, suppress automatic titles for T statistics 2-15 notbl, suppress table numbers 2-15 Notes file for Quanvert (Windows) 4-90 notitle, suppress table titles 2-32 notopc, suppress percent sign at top of column 2-32 notstat, exclude element from T stats 2-32, 2-44, 2-45, 2-116, 3-145 notstatdebug, no intermediate figures for T stats 2-32 notype, suppress output type message 2-24, 2-32 nouseeffbase, don’t use weighted counts for standard error 2-32 nowmerrors, suppress weighting errors 2-32, 3-10 nqtsas, convert Quantum data & spec to SAS 4-65 nqtspss, convert Quantum data & spec to SPSS 4-44 how differs from qtspss 4-44 options with 4-52 nsw, squared weight element 2-30, 2-49, 2-143, 3-147 ntd, significant net difference test 3-166 ntot, exclude element from totals 2-116, 2-130, 4-87 ntt, text-only net element 2-71 Null response, check for 1-205 numb, number of codes in a column 1-28 data-mapped variables 1-216 Numbering tables 2-210 with hitch and squeeze 2-196 Numbers 1-16 large, in tables 2-27 numcode, flag axis as single coded 2-44 numdir.qv, number of variables per directory 4-80 Numeric codes elements for 2-94, 2-97 exporting to SAS 4-63 exporting to SPSS 4-42, 4-49 Numeric conditions, defining with val 2-89 Numeric fields, missing values in edit section 1-172 Numeric variables compress in Quanvert Text 4-115 create for Quanvert 4-70 define which to flip 4-78 levels with 3-59 prevent creation of, in Quanvert Text 4-83 nums, unmanipulated cell counts file 1-229 nums.man, manipulated cell counts file 1-229, 4-22 nz, suppress all-zero elements 2-44, 2-116 apply to manipulated elements 3-31 nzcol, suppress all-zero columns 2-15, 2-32 apply to manipulated elements 3-31 nzrow, suppress all-zero rows 2-15, 2-32 apply to manipulated elements 3-31
O One dimensional chi-squared test 3-73 formula 3-89 One sample T-test 3-101 example 3-102, 3-103 formula 3-117 One sample Z-test 3-93 example 3-94 formula 3-115 One-way analysis of variance 3-110 example 3-110 formula 3-119 Online edit accepting records 1-165 canceling 1-167 correcting data 1-163 creating new cards 1-166 delete codes from column 1-163 deleting cards 1-166 displaying columns 1-162 e 1-163 ed 1-166 insert codes in column 1-163 overwrite column 1-163 redefine command names 1-167, 4-7 re-edit current record 1-166 reject record in 1-165 rt 1-165 s 1-163 split 1-161 terminate for current record 1-165 write 1-161 online, interactive data correction 1-160 op=, output types 2-15, 2-117 A/B percentage differences 2-124, 2-126 order of printing with 2-17 separate tables for different output types 2-17 with rotated grid axes 2-245 Open ended responses 4-74 Options defining run defaults 2-32 on a 2-8, 2-9 on add 2-186 on col 2-112 on div 2-187 on fld 2-112 on flt 2-9, 2-217 on l 2-40 on m 3-25 on n statements 2-112, 2-117 on sectbeg 2-9 on sid 2-180 on tab 2-9, 2-174 on und 2-180 on val 2-112 on wm 3-7 switching off 2-32
Index / 319
Quantum User’s Guide Volume 2
.or., logical or 1-40 or, logical operator for assignment 1-100 ord, line layout for table of contents 3-192 order=, alphanumeric card types 1-58 ori, justification of table titles 2-215 out1, compilation listing 1-226, 4-13, 4-23 out2, records failing write/require 1-228, 4-17, 4-23 out3, cumulative output summary 1-230, 4-22, 4-23 Output data file for require 4-18 Output options display width in Quanvert Text 4-85 order of with percent diffs 2-127 printing multicoded data 1-80 Output program 1-230 Output type descriptions, with hitch/squeeze 2-191 Output types defining 2-15 order of printing 2-17 print on tables 2-24 separate tables for different types 2-17 suppress printing of 2-24, 2-32 overlap, overlapping data with T stats 2-30, 3-159 overlapfoot, print overlap message for T stats 3-160 Overlapping data footnote about 3-160 special T stats 2-30, 3-159
P p, position cell counts 2-167 Packed databases 4-124 join split database 4-127 maximum size of 4-124 split file 4-127 unpack packed file 4-126 Packing databases 4-129 extra files for Quanvert (Windows) 4-91 , page numbers on tt statements 2-213 pag, page numbers 2-213 Page break suppress between all tables 2-191 suppress between split wide tables 2-190 suppress between tables 2-190 Page length 2-18 Page numbers switching off 2-213 user-defined, positioning with tt statements 2-213 with and 2-178 with hitch/squeeze 2-191 with multidimensional tables 2-174 Page width 2-18 set for Quanvert Text 4-85 suggestions for Quanvert 4-71 page, automatic page numbering 2-18, 2-32
320 / Index
Pages center tables on 2-22 number of lines on 2-18 numbering 2-18, 2-213 print more than one table on 2-188 start new 2-108 suppress numbering 2-18, 2-32 width of 2-18, 4-71, 4-85 Pagination automatic 2-105 order in split tables 2-107 precedence of rows & columns 2-19 paglen, page length 2-18 pagwid, page width 2-18 Quanvert Text 4-85 Paired preference test 3-170 formula 3-181 P-values for 3-173 Paired T-test 3-101 example 3-102, 3-103, 3-104 formula 3-117 Panel studies cross-referencing levels in 4-73 flip individual waves 4-112 link waves in 4-113 weighting in 4-113 Paper saving output 2-191 Parentheses, with data variables 1-197 Partial column replacement 1-92 pc, print percent signs 2-18, 2-32 PC-NFS, access Unix databases with 4-130 pcpos=, position of percentages 2-18, 2-117 pcsort, sort on percentages 2-18, 3-128 pczerona, print NA for percents with zero bases 2-19 –pd, directory for permanent files 1-232 Penetration tables creating with celllev= 3-58 creating with clear= 3-65 Percentage differences 2-125 flag table for 2-175 order of op= options with 2-127 Percentages 100% on base row 2-10, 2-16 against redefined base 2-16 column 2-16 example of 2-57 suppress small 2-21, 2-117 cumulative 2-16, 2-34 decimal places 2-11, 2-113 forced rounding to 100% 2-19 nets 2-73 position relative to absolutes 2-117 print NA for percents with zero bases 2-19 print percent signs 2-18, 2-22 printing flush with absolutes 2-11 redefined bases, example of 2-103 row 2-16 suppress small 2-21
Quantum User’s Guide Volume 2
Percentages (continued) side by side with absolutes 2-17 sorting 2-18, 3-128 suppress if have small base 2-20, 2-196 suppress percent signs 2-18, 2-32 suppressing for a single row 2-118 total 2-15 example of 2-33 suppress small 2-21, 2-117 with sid and und 2-182 Percentiles factors in reverse sequential order 2-146 from absolute values 2-30, 2-144, 2-149 from factors 2-144, 2-145, 2-146, 2-148 interpolation method 2-28, 2-146, 2-151 Permanent files, directory for 1-232 physpag, page numbering with hitch and squeeze 2-19, 2-32 Position of cell counts in tables 2-167 post=, postweighting 3-8, 3-16 inctext= invalid with 2-123 Postprocessors for Quanvert Text 4-82, 4-85 PostScript personalized code for laser printed tables 3-213 printing tables with 3-198 special characters in axes 3-199 suppress table of contents 3-211 user-definable characters 3-201 #postscript, start PostScript code 3-213 Postweights 3-6, 3-16 Pounds signs in tables 3-198 ppt, paired preference test 3-170 pre=, preweighting 3-8, 3-16 inctext= invalid with 2-123 Precoded response, check for 1-206 Prevent access to unweighted data in Quanvert 4-116 Preweights 3-5, 3-16 Print files define default output for 1-81 PostScript 3-198 turn off default parameters for 1-83 printed_, current record has been written out 1-67 Printing | and ! in element texts 3-202 Printing DNA and NA for missing values 4-74 Printing multicodes, output options 1-80 Printing records ident 1-81 qfprnt 1-84 require 1-145 write 1-65 printz, print all-zero tables 2-19 priority, force single-coding 1-104 private.c, C subroutine code file 4-11 private.o, compiled C subroutine code file 4-22 process, tabulate record 1-129 effect on Quanvert databases 4-75 example of 1-130, 2-100 position in edit 1-131
process, tabulate record (continued) with levels 3-63 Product tests, example of 2-247 Profiles postprocessors for Quanvert Text 4-82, 4-85 prevent use of in Quanvert Text 4-85 profopts, Quanvert Text postprocessor file 4-82, 4-85 Programs accum 1-229 bintab 4-174 colrep 4-27 components of 1-3 datapass 1-227 flipclean 4-97 format of 1-8 manip 1-229 manipclean 4-25 mflip 4-101, 4-107 nqtsas 4-65 nqtspss 4-44 pstab 3-198 q2cda 4-32 qout 1-230 qsj 4-125, 4-127 qteclean 4-25 qtext 4-167 qtlclean 4-25 qtoclean 4-25 qtsas 4-56 qtspss 4-38 quclean 4-25 qvclean 4-98 qvpack 4-129 qvpk 4-124 qvq2cda 4-32 qvsecure 4-116 qvshrinc 4-115 qvtr 4-126 qvtrans 4-130 qvupdate 4-119 storing 1-3 tabcon 3-189 textq 4-167 weight 1-229 Project selection file 4-111 Project text file 2-176, 4-23, 4-77 Projects, select from multiproject database 4-111 Prompts, translating for Quanvert Text 4-81 prop, t-test on column proportions 3-160 propcorr, continuity correction for t-test 3-161 propmean, t-test on column props & means 3-161 Proportions compare with significant net difference test 3-166 test for given values 3-93
Index / 321
Quantum User’s Guide Volume 2
Proportions (continued) test of differences between overlapping samples 3-99 between subsamples 3-97 t-test on column 3-160 two sample test of difference 3-95 pstab, create PostScript tables 3-198 ptf, translation file 2-176, 4-23, 4-77 Punch codes, ASCII equivalents 4-175 punch()=, symbolic parameters for codes 2-232 punchout.q, records written out by require 1-228, 4-18 pvals, print P-values for special T stats 3-159 P-values Newman-Keuls test 3-165 paired preference test 3-173 significant net difference test 3-169 t-test on column means 3-164 t-test on column proportions 3-163
Q q2cda, Quantum tables to CDA 2-82, 4-32 column headings 2-169 options with 4-35 qdi files 1-201, 1-217 qdiaxes, generate Quantum spec 1-217 qextras.lst file for Quanvert (Windows) 4-91 qfprnt, write out data in user-defined format 1-84 qnaire.txt file for Quanvert (Windows) 4-91 qotext.dat 4-82 qout, output program 1-230 qqhct, holecount file 4-17 qsj, split or join databases 4-125, 4-127 QTAXES, maximum number of axes per run 4-10 qteclean, delete files created by edit-only run 4-25 QTEDHEAP, to adjust edit statement complexity 4-10 QTELMS, max number of elements per axis 4-10 qtext, convert Quantum data to text format 4-167 QTFORM define special characters for laser printing 3-201 QTHEAP, max number of characters per axis 4-10 QTHOME, Quantum home directory 1-223 QTINCHEAP, max number of characters for inc= variables 4-10 QTINCS, maximum different inc= per run 4-10 QTINLISTHEAP, adjust definelist complexity 4-10 qtlclean, delete temporary compilation files 4-25 QTLEXCHARS, max size of long text strings 4-10 qtm_ex_, datapass program 1-227 QTMANIPHEAP, max size of expressions 4-10 QTNAMEVARS, max num of named variables 4-10 QTNOPAGE, suppress blank page 4-23 QTNOWARN, suppress license expiry warning 4-11 qtoclean, delete files created by quantum -o 4-25
322 / Index
qtsas, convert Quantum data & spec to SAS 4-56 qtspss, convert Quantum data & spec to SPSS 4-38 how differs from nqtspss 4-44 QTSPSSRC, nqtspss options 4-55 QTTEXTDEFS, max num of text symbolic params 4-10 Quancept 1-201, 1-205, 1-217, 1-218 Quantum program components of 1-3 format of 1-8 modify for Quanvert 4-68 options with 1-224 storing 1-3 which version to use 1-223 Quanvert 4-67 add with 4-71 allow creation of new axes 4-96 allow use of special T statistics 4-76 alpha variables 4-73, 4-74 axis titles 4-68 create database 4-93 create uniq_id variable 4-121 defining axes 4-68 effective base elements 3-149 export grids to SAS and SPSS 2-40, 2-249 files 4-94 files which must be present 4-96 filters 4-71 levels cross-reference files 4-94, 4-95 levels data 4-72, 4-73 missing values 4-74 n25 with 4-76 naming weighting matrices 4-71 norow/nocol/nohigh with 4-75 numeric variables 2-123, 3-60, 4-70 page width suggestions 4-71 prepare weighted databases 4-71 prevent access to weighted/unweighted data 4-116 process with 4-75 reduce disk space for database 4-75 respondent serial numbers 4-71 secure databases 2-45, 2-118 special T statistics 4-76 temporary directories 1-232 text at bottom of tables 4-71 trailer cards with 4-72 weighting matrices 3-8 Quanvert (Windows) 4-67 database icon 4-90 databases 4-86 languages 4-77 levels data 4-88 news file 4-90 notes file 4-90 packing extra files 4-91 percentiles 2-151 questionnaire file 4-91
Quantum User’s Guide Volume 2
Quanvert (Windows) (continued) set up to use .wav files 4-74 special T statistics 2-116 stats.ini file 4-86 variable groups 4-68 Quanvert Create Utility 4-67 Quanvert Menus 4-67 Quanvert Text 4-67 access rights to files 4-81 command availability 4-83 convert tables to CDA format 4-32, 4-35 creating large axes 4-83 display width 4-85 dummy axis 4-84 filtering on per-user basis 4-84 languages 4-84 multiproject databases 4-107 n11 4-85 page width 4-85 panel studies 4-73 postprocessors for profiles 4-82, 4-85 prevent alteration of texts 4-83 prevent creation of variables 4-83 prevent use of profiles 4-85 restrict access to axes and variables 4-84 row text width 4-85 translation file for prompts 4-82 translation of prompts 4-81 Quartiles, see percentiles quclean, delete temporary files 4-25 wildcard characters with 4-26 Questionaire data information files 1-201 generate Quantum spec from 1-217 Questionnaire file for Quanvert (Windows) 4-91 qvclean, remove all files for a survey 4-98 qvgroup, groups in Quanvert Windows 4-68 qvlv files, levels cross-reference files for Quanvert 4-95 qvmerge, merge variables into existing database 4-100 qvpack, pack databases 4-129 alias file for 4-128 files required by 4-125 qvpk, pack databases 4-124 qvq2cda, Quanvert Text tables to CDA 4-32, 4-35 qvsecure, create secure Quanvert database 4-116 qvshrinc, compress .inc files 4-115 qvtext.dat 4-82 qvtr, unpack databases 4-126 qvtrans, convert unpacked files 4-130 alias file for 4-128 qvupdate, update Quanvert 4-119
R Random code, set into column 1-107 Random numbers, generating 1-29 random, generate random numbers 1-29 range, check arithmetic value of field 1-38 rangeb, test arithmetic value of field, with blanks 1-39 Ranges as conditions 2-92 Ranking see Sorting Ranks in Friedman test 3-85 Raw counts in secure databases 2-45, 2-118, 4-116, 4-118 read=, how to read data 1-54 Real numbers 1-16 copying into columns 1-98 saving in integer variables 1-96 significant figures with 1-16 Real variables 1-21 defining in subroutines 1-189 reset to zero 1-111 Reals and integers in the same expression 1-27 rec_acc, number of records accepted 1-125 rec_count, number of records read so far 1-52 rec_rej, number of records rejected 1-125 reclen=, record length 1-54, 2-250, 4-2 Record length 1-54, 1-78 in levels data 3-48 in non-std data files 2-250 with levels 4-2 Record structure, defining 1-53 Record type, defining 1-53 Records counting by axis name 2-25 distribute one element across the axis 2-129 examining with list 1-138 last in file, checking for 1-52 maximum cards in, in levels jobs 4-2 maximum sub-records per, in levels data 3-48 multicard with more than 100 cols per card 1-63 number read in so far 1-52 printing 1-145 rejecting from tables 1-145 types of 1-47 writing out parts of 1-68 Redefined base, percentaging against 2-16 Reformatting data 2-53 Refused, data-mapped variables 1-205 rej=, excluding elements from the base 2-125 reject, omit record from tables 1-124 with require 1-126 rejected_, current record has been rejected 1-125 Rejecting records from tables 1-124, 1-145 rep=, repeated card types 1-56 Repeated card types defining 1-56 in unusual order 1-52 missing 1-52
Index / 323
Quantum User’s Guide Volume 2
report, write data to report file 1-70 report=, report type for rim weighting 3-21 req=, required card types 1-56 require, validating codes and columns 1-144 action codes 1-145 actions when test fails 1-156 automatic error correction 1-151 checking codes in columns 1-148 checking exclusive codes 1-150 checking logical expressions 1-153 checking routing 1-155 checking type of coding 1-146 comments with 1-147 correcting errors from 1-160 data output file for 4-18 data validation 1-143 defaults with 1-152 equivalence of logical expressions 1-154 file of records failing 4-17 with if 1-157 Required card types 4-2 defining 1-56, 3-46 Reserved variables allread 1-50 card_count 1-52 firstread 1-51, 3-64 lastread 1-51, 3-65 lastrec 1-52 number of cards read so far 1-52 number of records accepted 1-125 number of records read so far 1-52 number of records rejected 1-125 printed_ 1-67 rec_acc 1-125 rec_count 1-52 rec_rej 1-125 record written to out 1-67 rejected_ 1-125 stop statement executed 1-127 stopped_ 1-127 this record rejected 1-125 thisread 1-50 with trailer cards 1-50 Reserved words with flip 4-70 Resetting variables between respondents 1-97 resp(#)=, substitution for data-mapped variables 1-215 Response, assign to data-mapped variable 1-209 return, go to tabulation section 1-126 with levels 3-50 with reject 1-126 rgrid, rotated grid tables 2-245 Rim weighting 3-3, 3-7, 3-19 efficiency, formula 4-19, 4-21 parameters file 4-5 report for each iteration 3-21 root mean square 3-4, 3-20, 4-20 summary information for 4-19
324 / Index
rim, rim weighting 3-7 rinc, rows take precedence when paginating large tables 2-19, 2-107 Risk level for special T stats 3-156 rj, reject record in online edit 1-165 rm, delete cards in online edit 1-166 Root mean square 3-4, 3-20 formula 4-20 Rotated grid tables 2-245 round, forced rounding to 100% 2-19, 2-32 Rounding to 100% 2-19, 2-32 Routing checking 1-155 using go to 1-118 with loops 1-124 Row manipulation 3-25 expressions for 2-119 ids for 2-115 Row offsets with added tables 2-184 Row percentages 2-16 force to round to 100% 2-19 suppress small 2-21 Row ranks in tables 2-16 row, row element 2-116, 2-140 Rows alignment of text in laser printed tables 3-203 basic counts 2-83 created with col 2-83 indenting folded text 2-13 reprint at top of continued tables 2-109, 2-114 sorting 2-20, 3-126 suppressing small 2-21 text width 2-20 text width in Quanvert Text 4-85 rpunch, set a random code into a column 1-107 rqd, default action code for require 1-146 rsort, sort rows 2-20, 3-125 rt, terminate online edit for current record 1-165 Run conditions, defining 2-8 Run defaults file see Default options file Run definitions file 4-3 Run file, generate from qdi file 1-220 Run ids for table manipulation 3-38
S s, assignment in online edit 1-163 s, side element for manipulation 3-41 Sample Quantum job 2-253 Sample tables cumulative percentages 2-34 hitch/squeeze 2-191 inc= 2-136 indices 2-35 means 2-36 multidimensional tables 2-172
Quantum User’s Guide Volume 2
Sample tables (continued) subtotals 2-136 suppress percents with small bases 2-199 total percentages 2-33 totals 2-136 totals and subtotals 2-121 Sample variance, see Error variance SAS convert Quantum data/spec to 4-56, 4-65 don’t export element to 2-115 export grid in Quanvert 2-40, 2-249 export missing data as missing_ 2-124 numeric data 4-63 scale=, scaling factor 2-30, 2-32, 2-117 Scaling factors, defining 2-30, 2-117 sectbeg, start nested table section 2-222 sectend, end nested table section 2-222 Secure Quanvert databases 2-45, 2-118, 4-116 security level 4-117 Segments, defining in an axis 3-69 sel, titles to print in table of contents 3-193 Semicolons in strings 1-90 in texts 2-51 ser=, serial number location 1-55, 3-47, 4-2 Serial number, location of 1-55, 3-47, 4-2 Serial numbers in Quanvert 4-71 *set, define T variable in data file 1-113 set, assignment statement 1-89 sid, tables side by side 2-180 column headings with 2-181 g statements with 2-181 options with 2-180 percentages with 2-182 sorting with 2-182 table headings with 2-181 side, identify rows in grid axes 2-238 side=, row text width 2-20 Quanvert Text 4-85 Significant net difference test 3-166 formula 3-181 P-values for 3-169 Similar projects, linking 4-101 Simplifying your spec by reformatting the data 2-53 Single class. chi-squared test 3-78 example of 3-80 formula 3-90 Single columns, checking contents of 1-32 Single quotes, with codes 1-14 Single-coded axes, testing for 2-40 Single-coded data, from multicoded data 1-181 Single-coded, flag axes as 2-44 Small suppression, switching off 2-32 smallbase=, small base for T stats 2-20, 3-150 smbase=, suppress percents/stats with small bases 2-20, 2-196 smcol, suppress small columns 2-20, 2-32 smflag=, flag cells with small bases 2-20
smrow, suppress small rows 2-21, 2-32 smsup+, sum of suppressed elements 2-118 smsupa=, suppress small absolutes 2-21, 2-117 smsupc=, suppress small percentages 2-21, 2-117 smsupp=, suppress small percentages 2-21, 2-117 smsupt=, suppress small total percentages 2-21, 2-117 smtot, suppress small base values 2-21, 2-32 sort, sort rows 3-125 sort, sorted table or axis 2-21, 2-32, 2-44 sortcol, sort on this column 2-118 Sorting axes 2-44 cancel global for one axis 2-45 column on which to sort 2-118 columns 2-10, 3-127 effect on text-only elements 3-137 end of subgroup 2-113 example with three levels 3-131, 3-135 manipulated elements 3-141 nesting subsorts 3-135 nets 3-128 on non-base element 3-126 percentages 2-18, 3-128 rows 2-20, 3-126 secondary levels, example of 3-129, 3-134 start of subgroup 2-118 statistical elements 3-141 tables 3-125 tables of means 3-141 tables of summary statistics 3-142 text-only rows as sublevel headings 3-138 totals 3-141 unsorted rows 3-129 with sid and und 2-182 within nets, example of 3-129, 3-134 Sound files in Quanvert (Windows) 4-74 spechar=, special characters 2-21 apply to manipulated elements 3-31 with statistics 2-22, 2-137 Special response, check for 1-206 Special T statistics continuity correction 3-161 effective base 2-119, 2-153, 3-147 elements with ntot 4-87 exclude elements from 2-32, 2-44, 2-45, 2-116 formulae 3-175 include elements in 2-31, 2-45, 2-119 intermediate figures for 2-22, 3-157 least sig. diff. test 3-175 levels 3-62, 3-149, 4-88 minimum effective base for 2-29 Newman-Keuls test 3-165, 3-184 nsw elements for 3-147 on weighted jobs 3-147 overlapping data with 2-30, 3-159 paired preference test 3-170
Index / 325
Quantum User’s Guide Volume 2
Special T statistics (continued) print overlap message 3-160 P-values for 3-159 Quanvert (Windows) 2-116, 4-86 Quanvert databases 4-76 requesting 3-154 selecting elements for 3-145 significant net difference test 3-166 small base for 2-20, 3-150 suppress automatic titles 2-15 suppress overlap footnotes 2-15, 3-160 titles for 3-151 t-test on column means 3-164 t-test on column proportions 3-160 t-test on column proportions & means 3-161 very small base for 3-150, 3-151 Specified other, check for 1-205 Split database files 4-127 joining 4-127 Split or join databases 4-125 split, create clean & dirty files 1-167 Splitting long column headings 2-163 SPSS convert Quantum data/spec to 4-38, 4-44 don’t export element to 2-115 export grids from Quanvert 2-40, 2-249 export missing data as missing_ 2-124 force an axis to be multicoded 2-41, 4-50 numeric data 4-42, 4-49 sqrt, square root manipulation operator 3-26 Square roots 1-183, 3-26 Squared weighting elements 2-30, 2-49, 2-143, 3-147 squeeze=, squeeze table onto one page 2-22, 2-188 how Quantum compares table texts 2-194 numbering printed pages 2-19 paper saving mode 2-191 print page numbers logically/physically 2-196 suppress column headings with 2-193 table texts with 2-191 with wide tables 2-190 Stages in a Quantum run 1-223 Standard deviation 2-136 formula 2-156 function of 2-139 produced by list 1-139 suppress if has small base 2-20, 2-196 weighted base less than 1.0 2-143 Standard error of the mean 2-136 calculate using weighted figures 2-31 formula 2-157 function of 2-139 in weighted jobs 2-143 suppress if has small base 2-20, 2-196 use weighted counts in 2-143 stat=, axis-level statistics 3-68 stat=, table-level statistics 2-31, 3-70 statdata, SAS data file 4-65
326 / Index
Statements aliases for 4-6 continuation of 1-9 length of 1-4 statistical 2-136 Statistical elements, in sorted tables 3-141 Statistical statements, list of 2-136 Statistics analysis levels with 3-61 exclude missing values from 2-142 F and T values 3-108 factors for 2-119 flag cells with small bases 2-20 general notes about 3-71 more than one per axis 3-69 more than one per table 3-71 Quanvert (Windows) 4-86 sorted summary tables of 3-142 spechar with 2-22, 2-137 squared weighting elements for 2-30, 2-49, 2-143, 3-147 summary table of requirements 3-72 table-level 2-31, 3-70 triangular array of 3-71 see also Special T statistics stats.ini file for Quanvert (Windows) 4-86 stop, terminate the edit 1-127 stopped_, stop statement executed 1-127 Storing your program 1-3 Strings of data constants 1-15 Strings, semicolons in 1-90 struct, define record structure 1-53 with levels data files 3-48 Subaxes end of group 2-77 naming groups on elements 2-79, 2-114 start of group 2-77 tables from 2-80 Subdirectories, store variables in 4-80 Subheadings in sorted tables 3-137 in tables 2-62 nesting in column axes 2-63 positioning above columns 2-65 underline 2-63 Subroutines arguments with 1-188 convert multicoded data to single coded 1-181 defining variables in 1-189 explode 1-181 fetch 1-178 fetchx 1-180 load data from look-up file 1-178, 1-180 using 1-177 writing your own 1-182 Subscription 1-23, 1-91 subsort, start secondary level sorting 2-118, 3-134
Quantum User’s Guide Volume 2
Substitute variable names in data-mapped variables 1-215 Subtotals 2-133, 2-134 sample table with 2-136 Subtraction 1-26 Sum of factors 2-144 formula 2-156 produced by list 1-139 sum_, sorted summary of datapass errors 1-228, 4-18, 4-23 summary, keyword for secure databases 2-45, 2-118, 4-116, 4-118 supp, suppress percentages for a row 2-118 Suppressed elements, sum of 2-118 Suppressing percentages with small bases 2-196 Suppressing small absolutes 2-117 Suppressing small column percentages 2-117 Suppressing small total percentages 2-117 Suppressing statistics with small bases 2-196 Suppressing tables 2-15 Suppressing the base on continuation pages 2-57 Switching off options 2-32 SYLK format files, creating 2-13 Symbolic parameters codes 2-232 columns 2-228, 2-229 function of 2-227 global values for 2-237 how Quantum interprets 2-229 in grid axes 2-239, 2-240 text 2-234 variables 2-235 with col and val 2-231
T T and F values with nft 3-108 T statistics see Special T statistics T variables, define in data file 1-113 t1, one sample/paired T-test 3-101 t2, two sample T-test for comparing means 3-105 , table numbers on tt statements 2-211 Tab section, jump to from edit 1-126 tab, name axes for table 2-171 options on 2-9, 2-174 tab_, tables file 1-230, 4-24 font numbers on right side 2-12 suppressing blank page 4-23 tabcent, center tables on the page 2-22 tabcon 3-189 Table numbers 2-210 justification of 2-211 suppress 2-15 switching off 2-211 user-defined, positioning with tt 2-211 with and 2-211
Table numbers (continued) with hitch/squeeze 2-191 Table of contents create 3-189 format file 3-190 format file, naming 3-194 suppress for PostScript tables 3-211 Table texts customizing 4-7 how Quantum compares with hitch/squeeze 2-194 see also Titles #tableleft, print table on left of page 3-211 Table-level statistics 2-31, 3-70 Tables adding 2-182 dummy elements 2-186 example of 2-184 sample program for 2-183 with column offsets 2-183 with row offsets 2-184 adjacent absolutes & percentages 2-17 analysis level for 2-10, 3-53 asterisks in 1-16 boxes in 3-206 center on page 2-22 column width 2-10, 2-41 combining 2-179 convert to CDA format 4-32, 4-35 dividing 2-186 double spacing in 2-11, 2-113 filtering 2-11 fonts for laser printing 2-11, 3-209 footnotes on 2-208 generating from qdi file 1-221 grids 2-238 incrementing cells by arithmetic values 2-120 introduction to 2-1 languages 2-13, 2-176 large numbers in 2-27 laser printed, justification of column headings 3-199 logos on 3-209 manipulating see Manipulation maximum values of inc=s 2-28 mean values of inc=s 2-28 minimum values of inc=s 2-29 more than one per page 2-188 multidimensional 2-171 naming axes for 2-171 numbering 2-210 numbering with and 2-211 numbers in 1-16 one beneath the other 2-180 order of titles 2-24 page numbers for 2-213 pagination order in 2-107 pagination with wide breakdowns 2-190
Index / 327
Quantum User’s Guide Volume 2
Tables (continued) paste one under the other 2-188, 2-195 placing side by side 2-180 position of cell counts in 2-167 position on page 3-211 pounds signs in 3-198 precedence of rows & columns when paginating 2-19 print base title last 2-10 print date on 2-10 print output type on 2-24 print text in main body of 2-61 reprint rows at top of continued 2-109, 2-114 row text width 2-20 separate for different output types 2-17 sorted means 3-141 sorted summary statistics 3-142 sorting 2-21, 3-125 suppress column headings 2-193 suppress if base less than given value 2-21 suppress numbering 2-15 suppress output type on 2-24 suppress page break between 2-190 suppress the base on continuation pages 2-57 suppressing all-zero 2-19, 2-32 suppressing printing 2-15 texts 2-5, 4-7 titles and other texts with hitch/squeeze 2-191 titles at bottom of page 2-210 titles for 2-181, 2-203 titles from axis names 2-10 titles from hd= text 2-22 titles to print first 2-23 titles to print last 2-24 types of data in 2-3 unsorted where default is sorted 2-32 updating cells at higher level than axes 3-54 using dummy data 3-43 using subaxes 2-80 vertical lines in 2-167 Tables file 4-22 tabn.syl, graphics files 4-22 Tabulation section C code in 3-123 components of 2-7 editing in 3-124 hierarchies in 2-8 Tabulation statements, format of 1-5 Tags, internal variable names 4-15, 4-24, 4-94 Target weighting 3-2, 3-7 target, target weighting 3-7 tb, table numbers 2-210 tba, left justify table numbers on first page 2-211 tbb, right justify table numbers on first page 2-211 tc.def, table of contents format file 3-194 –td, directory for temporary files 1-231 Temporary disk space for a run 4-178
328 / Index
Temporary files delete 4-25 directory for 1-231 summary of 4-23 Terminating the edit 1-127 Terminating the run 1-128 with tables 1-127 without tables 1-128 termwid, output width in Quanvert Text 4-85 Testing values of data-mapped variables 1-211 Text at the bottom of tables 4-71 break points 2-163 continuing in axes 2-66 indent element when split 2-115 numeric variables 2-27, 2-42, 2-123, 4-42 prevent alteration of, in Quanvert Text 4-83 print in body of table 2-61 row, indenting folded 2-13 symbolic parameters for 2-234 table titles 2-203 underlining on elements 2-119 Text files, convert to Quantum format 4-167 Text strings, limit for 4-10 Text variables, for Quanvert 4-73, 4-74 textconv, translate Quanvert Text prompts 4-82 textdefs, number of text symbolic parameters per run 4-9 Text-only elements 2-58 sorted tables 3-137 with col/val/fld/bit 2-88 textq, convert text to Quantum data format 4-167 texts.qt, customized text file 4-8 thisread, cards read during current read 1-50 title, table titles from axis titles 2-22, 2-32 Titles 2-203 altering default order 2-205 at bottom of page 2-210 creating from axis names 2-10 default printing order 2-205 defining for Quanvert 4-68 footnotes on tables 2-208 in laser printed tables 3-205 justification of 2-203, 2-215 order of 2-24 prevent alteration of in Quanvert Text 4-83 print base last 2-10 suppress automatic for special T statistics 2-15 T statistics 3-151 table description, customizing 4-7 table, from hd= 2-22 underlining 2-207 which to print first 2-23 which to print last 2-24 with hitch/squeeze 2-191 with nested filter sections 2-221 with sid and und 2-181 topc, percent signs at top of column 2-22, 2-32
Quantum User’s Guide Volume 2
toptext=, column text 2-118 Total percentages 2-15 example of 2-33 suppress small 2-21 Total, weighting to a given total 3-5, 3-7, 3-16 total=, weighting to a given total 3-7, 3-16 Totals 2-133 excluding elements from 2-116 in sorted tables 3-141 sample table with 2-136 with nets 2-134 Trailer cards correcting 1-170 definition of 1-48 preparing for Quanvert 4-72 reading 1-49 tabulating without levels 3-64 weighting 3-13 see also Repeated cards Translations 2-13, 2-176 Quanvert (Windows) 4-77 Quanvert Text 4-81 tstat, include element in T stats 2-31, 2-32, 2-45, 2-119, 3-145 tstat, request a special T stat 3-154 tstat.dmp, intermediate figures for T stats 3-157 tstatdebug, intermediate figures for T stats 2-22, 2-32, 3-158 tt, titles 2-203 in tabcon format file 3-191 with flt 2-218 with hitch/squeeze 2-191 tta, left justification of titles on first page 2-204 ttb, right justification of titles on first page 2-204 ttbeg=, titles to print first 2-23, 2-205 ttc, centered title 2-203 ttend=, titles to print last 2-24, 2-205 T-test exclude elements from 2-32 include elements in 2-31 on column means 3-164 formula 3-177 P-values for 3-164 on column proportions 3-160 formula 3-179 P-values for 3-163 one sample 3-101 example 3-102, 3-103 formula 3-117 in weighted runs 3-101 paired 3-101 example 3-102, 3-103, 3-104 formula 3-117 two sample 3-105 example of 3-106 formula 3-117 ttg, line up title with start of column headings 2-204 ttl, left justified title 2-203
ttn, indented title 2-204 ttord=, order for printing titles 2-24, 2-205 ttr, right justified title 2-203 T-variables 1-20 Two dimensional chi-squared test 3-76 example of 3-77 formula 3-89 Two sample T-test 3-105 example 3-106 formula 3-117 Two sample Z-test on proportions 3-95 tx=, text-only element with col/val/fld/bit 2-88 type, print output types 2-24, 2-32 Types of output 2-15
U u, underline column headings 2-168 und, tables one under the other 2-180, 2-181, 2-182 Underlining column headings 2-168 column headings with pstab 3-203 element texts 2-119 for separate column texts in q2cda 2-169 in laser printed tables 3-203 in table of contents 3-190 subheadings 2-63 titles 2-207 Uniform distribution, test for 3-73 uniq_id, unique respondent numbers for Quanvert 4-121 uniqid=, in element texts 4-105 axes generated by qdiaxes 1-222 Unique ID text, and data-mapped variables 1-209 Unknown file formats for databases 4-128 unl, underline text 2-63, 2-119, 2-207 Unpack databases 4-126 Unweighted data, prevent Quanvert access 4-85, 4-116 uplev=, axis update level 2-45, 3-56 comparison with celllev 3-58 example of intermediate file with 3-57 statistics with 3-61 update base for all records at anlev= level 2-124, 3-57 with grids 2-245 useeffbase, use weighted counts for standard error 2-31, 2-32, 2-143 *usemap, define data-mapping file 1-204 User-definable limits 4-9 Quanvert Text 4-83 Users file, for Quanvert Text 4-83
Index / 329
Quantum User’s Guide Volume 2
V
W
val, elements with numeric conditions 2-89 abbreviated notation for arithmetic equality 2-91 arithmetic equality with 2-89 count missing values 2-94 data-mapped variables 1-205, 1-213 options on 2-112 ranges with 2-92 text-only elements 2-89 var(#)=, substitution for data-mapped variables 1-215 var, count elements for data-mapped variables 1-213 Variable groups for Quanvert (Windows) 4-68 Variables add new to multiproject directories 4-107 add to database 4-99 alpha for Quanvert 4-73, 4-74 blank out 1-111 C array 1-18 checking contents of 1-31, 1-34 comparing 1-31, 1-35 data 1-18 data-mapped 1-201 defaults 1-198 defining in subroutines 1-189 external 1-199 integer 1-20 reset to zero 1-111 lastrec 1-52 local 1-199 naming 1-195, 4-15 naming in program 1-199 naming of files 4-95 numeric for Quanvert 4-70 passing with call 1-190 prevent creation of, in Quanvert Text 4-83 real 1-21 reset to zero 1-111 replacing in a database 4-98 resetting between respondents 1-97 restrict access in Quanvert Text 4-84 storing in subdirectories 4-80 subscription of 1-23 symbolic parameters for 2-235 T, define in data file 1-113 types of 1-17 see also Reserved variables Variables file 1-196, 4-1 varname=, variable name alpha variables 4-73 numeric variables 4-70 weighting matrices 3-8, 4-71 vartext=, description of variable 4-70, 4-73 Vectors in manipulation expressions 3-27, 3-35 Verbatim responses 4-74 Version of Quantum, selecting 1-223 Vertical lines in tables 2-167
.wav files 4-74 Waves flipping for panel studies 4-112 link into a single database 4-113 Weighted data, prevent access to 4-116 Weighted databases, prepare for Quanvert 4-71 Weighted panel studies 4-113 Weighting anlev= with 3-12 c= with 3-13 characteristics not known 3-19 declare in axes 3-14 defining characteristics for 3-7 effective base 2-119, 2-153, 3-147 entering weights 3-7 error handling 2-31, 3-10 error variance with 2-143 example of 3-9, 3-10 exclude respondents from 3-6 factors 3-2 frequency distributions 1-142 grid tables 2-246 holecounts 1-136 input 3-5 methods of 3-1 missing values with pre/postweights 3-8 multidimensional matrices 3-13 name matrix to use 2-31, 2-125, 3-23 naming matrices 4-71 number of matrices 3-7 one dimensional T-tests with 3-101 options for 3-7 postweights 3-6 preweights 3-5 program 1-229 proportions 3-5 Quanvert 4-71 report at each rim weighting iteration level 3-21 rim 3-3, 3-19 special T stats with 3-147 standard error with 2-143 summary information 4-19 targets 3-2 to a given total 3-5, 3-7, 3-16 trailer cards 3-13 unweighted records 3-2 uses of 3-1 using weights from record alone 3-17 see also Rim weighting Weighting report file 1-229, 4-19 weightrp, weighting report file 1-229, 4-19, 4-23 Weights abbreviating lists of 3-9 copying into data file 3-24 entering 3-9 for elements 3-14, 3-15
330 / Index
Quantum User’s Guide Volume 2
Weights (continued) minimum 3-18 switching off 3-23 using 3-23 Whole numbers 1-16 Wide tables, print all on one page 2-190 Width of terminal display for Quanvert Text 4-85 Wildcard characters with quclean, qteclean, qtoclean & manipclean 4-26 Windows-based Quanvert see Quanvert (Windows) wm, define a weight matrix 3-7 wm=, weighting matrix to use 2-31, 2-125, 3-23 wmerrors, weighting error handling 2-31, 2-32, 3-10 write, write out records 1-65 as part of another statement 1-66 correcting errors from 1-160 creating data files 1-69 default output file 1-67 define default print parameters for 1-81 defining the file type 1-78 file of records failing 4-17 override use of ruler with ident 1-83 specifying an output file 1-67 turn off default print parameters 1-83 with explanatory texts 1-67 writing selected fields only 1-68 wtfactor=, factor weighting 3-15 wttarget=, target weighting 3-14 wttran, copy weights into data 3-24
Z-test (continued) overlapping samples 3-99 example of 3-100 formula 3-116 subsample proportions 3-97 example of 3-96, 3-98 formula 3-116 two sample on proportions 3-95 formula 3-115
X xor, logical operator for assignment 1-101 X-variables 1-22
Z z1, one sample Z-test on proportions 3-93 z2, two sample Z-test on proportions 3-95 z3, Z-test on subsample proportions 3-97 z4, Z-test on overlapping samples 3-99 Zero exclude from averages 2-137 special characters for 2-21 suppressing columns 2-15 suppressing elements 2-32 suppressing rows 2-15 suppressing tables 2-19, 2-32 Z-test one sample 3-93 example of 3-94 formula 3-115
Index / 331