Advanced tables and statistics > Dealing with hierarchical data > Analysis levels > Tabulation using levels
 
Tabulation using levels
When data is processed using analysis levels, tab and l statements must indicate the level at which the table or axis should be updated - that is, is it to be updated once per higher level or once per sub-level.
Before tables are produced, Quantum creates an intermediate file in which cells are switched on or off depending on whether a respondent satisfies the conditions of a particular axis. If the condition is satisfied, the cell is switched on; if not, it remains off.
Normally, these cells are switched on when the record fulfils the conditions specified on the axis. All cells in the intermediate table are reset to zero before a new record is read. The axis:
l sex
col 10;Base;Male;Female
has two cells, Male and Female. Whenever a Male respondent is found, the first cell is switched on, and whenever a Female respondent is found, the second cell is switched on. In the example below, a 1 means that the cell is on and a zero means that it is off:
Respondent 1
Male
10
Respondent 2
Male
10
Respondent 3
Female
01
Respondent 4
Male
10
If the record contained trailer cards, the cells would be reset between reads. Therefore, with a record containing four trailer cards, the intermediate file would read:
First trailer card
Male
10
Second trailer card
Male
10
Third trailer card
Female
01
Fourth trailer card
Male
10
which is the same as the first example. In both cases, tables using these cells would indicate that there are three men and one woman: the table is a count of people. However, this might not always be what you want.
With hierarchical data, you might often want to produce tables in which the base is a count of records rather than a count of the number of times a particular condition was true. For example, you might want a table in which the base shows the number of households containing women, rather than the number of women in all households. For tables of this sort, you need to update the cells for each trailer card without resetting them between reads. This means that for each record, once a cell is switched on, it remains on for the whole of that record, regardless of the number of times the condition is fulfilled.
For a household of three men and a woman, the intermediate table would read:
Household 1,
Person 1
Male
10
 
Person 2
Male
10
 
Person 3
Female
11
 
Person 4
Male
11
Household 2,
Person 1
Female
01
Notice the difference between Persons 3 and 4 in this example and the same people in the previous example. Here, the cells remain switched on until all data has been read, whereas in the previous example cells were reset between reads. Tables produced with these cells would show that there is one household which contains men and women, but not how many of each there are.
Exactly when the cells in the intermediate table are updated or reset depends upon the type of table required and hence the keyword used on the tab or l statement. Keywords, described below, are:
anlev=level_name        celllev=level_name        uplev=level_name
See also
Analysis levels