Survey Tabulation > Working with variables > Adding a category based on another variable
 
Adding a category based on another variable
Sometimes you may want to add a new category that is based on another variable. For example, in the Museum sample data set, you can add a category to the biology variable that selects respondents who entered a value greater than 4 when answering the question "How many times have you visited the museum before today?" (this the value in the visits variable). You can do this by adding a user-defined category to the variable.
These instructions describe how to create a category for a variable so that it applies to all tables. If you want to create the category in a specific table, use the Edit Axis dialog box instead of the Edit Variable dialog box. The steps within the dialog box are the same. See Edit Axis dialog box for more information.
To adding a new category to a variable
1 Select the Define tab.
2 In the Variable List, select the variable you want to change.
3 From the menu, choose Variables > Edit.
This opens the Edit Variable dialog box: see Edit Variable dialog box.
4 Select the item in front of which you want the new category to appear. To add the category at the end, do not select anything.
5 From the menu at the top of the Edit tab, choose Insert.
This opens the Insert Item dialog box: see Insert Item dialog box.
6 In the list of Available Items, select User-Defined Category.
7 Click Add.
8 Click OK.
This inserts the new category into the list of items on the Edit tab.
9 Enter a label for the new category, for example, More than Four Visits.
In the row that contains the new category, click Edit item. This opens the Edit Category dialog box: see Edit Category dialog box.
10 In the Variable List, select the variable on which you want to base the new category, for example, visits.
11 Use the features on the right of the dialog box to define the expression for the category. For example, select the option Greater than from the list, then enter 4 in the text box. Then click OK.
12 Click OK again to close the Edit Variable dialog box.
Note The changes will be applied to any existing tables that include the variable next time you populate them, provided you haven't used the Edit Axis dialog box (see Edit Axis dialog box to specify how the variable is to appear in any of those tables).
See also
Working with variables