See Crunch Automation basics for more information.
The DISPLAY command sets subtotals and differences properties to be displayed for categorical variables (including categorical arrays), and subtotals only for multiple response variables.
- this is an example of a command that can take multiple input variables and create the same subtotals and differences on each. You can also specify a categorical array.
- cannot use differences (MINUS) for multiple response variables.
Each SUBTOTAL line requires you to specify which categories to include in the subtotal and what LABEL to give the output. You then have additional/optional modifiers about where the position of the subtotals should be in the list.
You can specify the categories to include by their category ID (which is not the same as the numeric value) or their label. If you are uncertain about the category ID, then use the label. You then need to give the subtotal a label (e.g., “Top 2 Box”).
The optional modifiers described include the POSITION as well as the usage of MINUS for the subtotal in the list.
The POSITION modifier sets the default and the POSITION TOP then puts all subtotals at the top of the categories. The AFTER puts a particular subtotal in a specific position. The AFTER modifier will take precedence over the POSITION modifier.
- You must specify the position in some way—whether you use it AFTER for each subtotal or you set a default using POSITION. Crunch needs to know where you want to put each subtotal.
- The position you give in the DISPLAY command will persist if you later reorder the categories (i.e., using the REORDER CATEGORIES command). Thus, it is good practice to first reorder the categories (if you need to) before you run the DISPLAY command, to ensure that you have the subtotals in the desired position.
DISPLAY alias, ..., alias SUBTOTAL code|"label", ..., code|"label" LABEL "string" [AFTER CODE code|"label"] ... SUBTOTAL code|"label", ..., code|"label" LABEL "string" [AFTER CODE code|"label"] [POSITION TOP|BOTTOM];
The MINUS modifier allows you to create SUBTOTAL differences by subtracting groups of categories:
DISPLAY approval, disapproval SUBTOTAL "cat 1", "cat 2" MINUS "cat 3", "cat 4" LABEL "Approve" AFTER CODE "cat 3" POSITION BOTTOM;
The following examples use the 2019 Mobile Technology and Home Broadband 2019 case study.
In the first example, consider the following variable:
The “All partnered” subtotal was created using the following script.
DISPLAY sns2_cat SUBTOTAL "Married", "Living with a partner" LABEL "All partnered" AFTER CODE "Living with a partner";
The categorical array is derived using the following script:
CREATE CATEGORICAL ARRAY sns2a, sns2b, sns2c, sns2d, sns2e LABELS "Twitter", "Instagram", "Facebook", "Snapchat", "Youtube" AS sns2_cat TITLE "Frequency of Social Media" DESCRIPTION "Thinking about the social media sites you use... About how often do you visit or use....?";
Then, we create subtotals on the array using the following script:
DISPLAY sns2_cat SUBTOTAL "Several times a day", "Once a day" LABEL "At least daily" POSITION TOP;
We can also create subtotals on multiple variables at once (provided they have the same categories). The following example creates bands on the 'Number of People In Household' variables.
DISPLAY hh1, hh3 SUBTOTAL 1...3 LABEL "1 to 3" SUBTOTAL 4...6 LABEL "4 to 6" SUBTOTAL 7,8 LABEL "7 or more" POSITION BOTTOM;