Tables and axes > Filtering groups of tables > General filter statements
 
General filter statements
Quick reference
To define filters and options for a group of tables, type:
flt[;c=logical_expression][;options]
More information
flt provides conditions, options and text for the group of tab statements which follow it; put it immediately before the first tab to which it refers. The filters and options remain operative until another flt statement is read or until overridden by different options for a single table.
The flt statement has the format:
flt[;filters and options]
filters and options are any of the keywords mentioned as valid on the tab statement in Options on the tab statement. Each option in the list must be separated by a semicolon.
For example, the statement:
flt;c=c106'2';nz;decp=2
causes:
All subsequent tables to be filtered to include women only (c=c106’2’).
All rows in which all cells are zero to be omitted.
All percentages to be shown to two decimal places.
Conditions (c=) defined on a flt statement are additional to those defined later on the individual tabs, whereas options apply to all tables unless overridden by a different version of themselves on the tabs.
If you write:
flt;c=c106'2'
tab occup region;c=c132'1'
ttlBase: Women in Full Time Employment
you are creating an ‘and’ condition for the table:
c=c106'2'.and.c132'1'
which will include all women who have full-time employment. On the other hand, if the flt defines a global scaling factor of 10 and an individual tab has a scaling factor of 5, the cells in all tables except the one with scale=5 are multiplied by ten before they are printed. Cells in the other table are multiplied by five.
Note In hierarchical data it is an error to specify inc= on flt statement without an anlev option being in force. However, an anlev option on the a statement will carry forward to the flt. For more information about hierarchical (levels) data, see Dealing with hierarchical data.
General filter statements can have and and tt statements associated with them, the former listing higher dimension axes to be used in all tables in the group, while the latter defines the text to be printed at the top of all tables, in addition to texts generated by the tab statement. For example:
flt;c=c106'2';nz;decp=2
and3 region
tab age occup
tab class age
tab occup class
produces three 3-dimensional tables:
Region by Age by Occupation
Region by Class by Age
Region by Occupation by Class
all of which include only women.
Flts can also be followed by foot and bot statements, each with tt statements defining other texts relevant to the group of tables as a whole.
Flt is useful when groups of tables have the same overall filters, or where a set of tables are to be produced more than once using different filters.
For example:
flt;c106'1';op=12
ttcMen
tab ax01 demo;c=c121'1'
ttcResident in Central London
tab ax01 demo;c=c121'2'
ttcResident in Outer London
tab ax01 demo;c=c121'3'
ttcResident in England Outside London
flt;c=c106'2';op=12
ttcWomen
tab ax01 demo;c=c121'1'
ttcResident in Central London
This example tabs the same set of axes for men and women separately. If you did not want such specific table titles (that is, showing the region), you could write this example more simply by generating a 3-dimensional table with region as the third dimension, thus:
flt;c=c106'1';op=12
ttcMen
tab region ax01 demo
        .
   Other tables
        .
flt;c=c106'2';op=12
ttcWomen
tab region ax01 demo
       .
       .
Yet another way of cutting down on the amount of writing is to make this a 4-dimensional table:
tab sex region ax01 demo;op=12
As you can see, there are many ways of tackling this. Which one you choose depends on what other tables you have to produce and the type of output requested by the client.
To cancel a filter altogether, rather than replacing it with another one, just enter a blank flt. This cancels both the conditions and options on the previous filter, and also any tt texts or and statements associated with it.
See also
Filtering groups of tables