Tables and axes > Introduction to axes > Subheadings and extra text > Subheadings in the axis > Nested subheadings for column axes
 
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'
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):
Visitors to the Museum
Sex Age
Base 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 can 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:
Visitors to the Museum Visited
Sex Age Museum Before
Base Male Female 11-20 21 -34 35-54 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, 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, write:
n23Visited Museum Before;hdlev=2;toptext=Been Before
and the headings are printed as:
Visitors to the Museum
Sex Age Been Before
Base Male Female 11-20 21 -34 35-54 55+ 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 the example above, each group of level 2 subheadings is followed by a col statement. For a full description of the col statement, see 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.
Note You can also specify the layout of column headings manually using g statements. For more information, see Manual set-up.
See also
Subheadings in the axis