When you have a table that uses subgroupings (one variable that was dropped onto another), there are often problems when trying to hide rows or columns in those subgroupings. When you hide or format a row or column in a subgrouping, the corresponding rows/columns in the other sub-groupings are also hidden. This makes it difficult to hide or format a row or column in one subgrouping but not the others. In addition, it is not possible to hide an entire subgrouping by hiding the associated caption or spanner. Fortunately, using value sets and multiple subtables, there are workarounds for these restrictions.
Hiding Subgroupings
There are two ways to hide an entire subgrouping. One way is to modify the value set used and the other is to use multiple subtables rather than subgroupings. Take the example of a table with Sex and Literacy as subgroupings on the row where you want to only show the sub-groupings for Total and Female. In other words, you would like to hide the subgrouping for Male.
If you try to hide the rows for the Male subgrouping using hide in the Format (Stub) dialog, it will not work. Hiding the Literate and Illiterate rows under Male will also hide those rows under Total and Female. Hide is not available in the Format (Caption) dialog if you right-click on the Male caption.
One way to work around this is to modify the value set for Sex to remove the Male category. Note that removing the Male category will also affect the Total (since males will no longer be counted). To fix this, add your own category to the Sex value set called Total, which includes the values for Male and Female. Finally hide the system generated total in the table (see Hide or Change the Position of the Total). The result is the following table:
A second approach is to use multiple subtables rather subgrouping. In our example you would drop the Literacy variable twice onto the rows to make two separate subtables. This would create the following table:
Next, modify the first subtable so that it becomes the subgrouping for Total and modify the second subtable so that it becomes the subgrouping for Male. To do this, first edit the captions for the two subtables to be "Total" and "Female" (see Customize Table Text). Next modify the universe of the second subtable to include only females (see Restrict a Universe). The first subtable will give the counts for all persons while the second subtable will give the counts for only females. This will give the same results as using the subgroupings:
Formatting and Hiding Rows/Columns in a Subgrouping
To hide or format a row or column in one subgrouping without effecting the other subgroupings you must use multiple subtables rather than subgroupings. This is because changing a row or column in one subgrouping will automatically cause the same change to the corresponding row in the other subgroupings. This is true for all format changes (font, color, alignment,…) as well as hiding rows/columns and modifying stub/column head text.
Take the earlier example of the Sex and Literacy table and try to make the text in the literacy row under the Total subgrouping bold without making the other literacy rows bold. If you simply set the format for this row to bold, the literacy rows in the Male and Female subgroupings will also become bold.
Instead of using subgroupings, drag the variable Literacy onto the rows three times to create separate subtables for the Total, Male and Female subgroupings.
Then edit the universe for the second subtable to only include males (see Restrict a Universe). In this case set the universe to SEX=1. Next edit the universe for the third subtable to include only females (SEX=2). Note that you do not need to edit the universe for the first subtable since you want to include both males and females (the entire population) which is the default universe. Next, edit the captions of the subtables to be "Total", "Male" and "Female" (see Customize Table Text). Finally right-click on the Literacy stub in the first (Total) subtable and set the font to bold. This results in the following table:
The same procedure works for hiding or modifying the stub text of an item in a subgrouping, only the last step changes. Rather than setting the font to bold, you would hide the row or modify the stub/column head text.
See also: Hide or Show a Row or Column, Hide or Change the Position of the Total, Formats for a Part of a Table, Implications of Data Dictionary Value Sets, Using Subtables