Advanced tables and statistics > Dealing with hierarchical data > Analysis levels > Table and axis analysis level
 
Table and axis analysis level
Quick reference
To define the level at which tables and/or axes are to be created, type:
anlev=level_name
on the a, sectbeg, flt, tab or l statement.
More information
The level at which tables or axes are to be created is defined using the anlev= keyword on the tab and l statements. It means ‘update the table or axis when all data for the named level has been read in’.
For example:
tab region class;anlev=hhold
ttlBase: Households
l region; anlev=hhold
col 136;Base;North;South;East;West
l class;anlev=hhold
col 126;Base;AB;C1;C2;DE
produces a table of region by class where the cells are incremented once per household.
Why is anlev=hhold used on both l statements? All people in a household are of the same class and live in the same region, therefore, each axis need only be updated once per household rather than once per person, which gives anlev=hhold on the axes.
anlev=hhold is needed on the tab statement to produce a table based on households not people.
Tab statements need not have the same analysis level as the axes which they use. For example, you might require two tables of region by class, one showing the number of households of each class in each region, and the other showing the number of people of each class in each region.
The two tables use the same axes, both of which have an analysis level of household. The first table is a count of households, so it too has an analysis level of household, but the second table is a count of people and thus needs to be updated once for every person in the household. Therefore, you give it an analysis level of person.
tab region class;anlev=hhold
ttlBase: Households
tab region class;anlev=person
ttlBase: People
l region;anlev=hhold
    .
l class;anlev=hhold
However, you cannot use anlev= to specify a level on the tab statement that is higher than the level on the axes. To do that, you must use the celllev option on the tab statement as explained next.
See also
Analysis levels