3 Introduction to axes
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:
☞
For information on col, val, fld and bit statements, see chapter 4, ‘More about axes’.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.
Quantum User’s Guide Volume 2
50 / Introduction to axes – Chapter 3
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.
Figure 3.1 Creating elements with n01 statements
Bread Purchase Survey Page 1 Absolutes/Col Percentages Base: All Respondents
Sex
Base Male Female ---Base 200 44 156 Marital Status
Single 44 6 38 22.0% 13.6% 24.4%
Married 122 27 95 61.0% 61.4% 60.9%
Divorced 33 10 23 16.5% 22.7% 14.7%
Widowed 1 1 1 .5% 2.3% 0%
Quantum User’s Guide Volume 2
Introduction to axes – Chapter 3 / 51 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’.
Quantum User’s Guide Volume 2
52 / Introduction to axes – Chapter 3
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:
Product Awareness Advert Awareness - First Other Aided Unaided Aided (110) (111) (112) (113) (114) Sparkle 1 1 1 1 1 Gleam 2 2 2 2 2 Suds 3 3 3 3 3 Washo 4 4 4 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.
Quantum User’s Guide Volume 2
Introduction to axes – Chapter 3 / 53 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.
Quantum User’s Guide Volume 2
54 / Introduction to axes – Chapter 3
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 (127)
Washing Silk 1 | 2 | 3 | 4 (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
Quantum User’s Guide Volume 2
Introduction to axes – Chapter 3 / 55 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.
Figure 3.2 Table for product tests
Preference for Selected Characteristics
Tried A Tried B
Total First First
Base 330 150 180
Washing Woolens 200 97 103
Noticed a Difference 61% 30% 57%
Prefer Product A 90 44 46
27% 30% 26%
Prefer Product B 82 36 46
25% 24% 26%
No Preference 28 17 11
9% 11% 6%
Did Not Notice a 130 53 77
Difference 39% 35% 43%
Quantum User’s Guide Volume 2
56 / Introduction to axes – Chapter 3
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.
Quantum User’s Guide Volume 2
Introduction to axes – Chapter 3 / 57 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.