Tables and axes > Include and substitution > Grid tables > Grid axes
 
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 can also be used in grid axes.
Note When you tabulate a grid axis, you need to use the grid keyword on the tab statement. For more information, see Cross-tabulating grid axes.
For example, start 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, 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, 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 the column headings and the values to be assigned to the symbolic parameter for each column. If you want to lay out the column headings in a particular way, write 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.
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, you still want to create the same table as before, with brands as columns. This time, 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'
These two examples show 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 they are defined with column symbolic parameters; in the second, the codes differed between columns, so they are defined 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.
For example, 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 people who have already purchased one of their products and also how likely people would be to buy them. c(212,213) indicate 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 is to buy the brand in the future.
Here is the axis which will produce the required table:
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
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 indicates that they 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 you can re-use one of the 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’, you 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, you 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.
Absolutes/col percents
Q20 - Number of Times purchased
Q21 - Purchase Intent

                                        Washo              Suds             Gleam           Sparkle

Base: All Who Purchased                   130               150               110               180     
Product

Number of Times Purchased

One                                         6                12                26                20
                                            5%                8%               24%               11%

Two                                        23                 3                11                30
                                           18%                2%               10%               17%

Three-Four                                 12                34                 5                26
                                            9%               23%                5%               14%

Five-Six                                   17                39                 9                51
                                           13%               26%                8%               28%

Seven-Ten                                  15                28                23                16
                                           12%               19%               21%                9%

More Than Ten                              42                25                23                20
                                           32%               17%               21%               11%

DK                                         15                 9                13                17
                                           12%                6%               12%                9%

Purchase Intent

All Respondents                           200               208               215               211

Definitely Will Buy                        31                21                20                33
                                           16%               10%                9%               16%

Probably Will Buy                          29                59                47                42
                                           15%               28%               22%               20%

Might or Might Not Buy                     57                43                56                61
                                           29%               21%               26%               29%

Probably Will Not Buy                      54                43                49                35
                                           27%               21%               23%               17%

Definitely Will Not Buy                    26                36                43                40
                                           13%               17%               20%               19%

DK/NA/Refused                               3                 6                 0                 0
                                            2%                3%                0%                0%

Grid table
See also
Grid tables