Survey Tabulation > Working with variables > Creating variables > Merging a categorical and a numeric variable
 
Merging a categorical and a numeric variable
Sometimes you may want to merge variables of different data types. For example, suppose you want to create a categorical variable for use as a banner or breakdown in your tables and you want this new categorical variable to merge one or more categorical variables and one or more numeric variables. This is possible in UNICOM Intelligence Reporter - Survey Tabulation, but not using the Merge option on the Variables menu.
To illustrate how this works, this topic walks you through creating a new categorical variable called Demographics that merges the data from a categorical variable (Gender) and a numeric variable (Age). This example is based on the Short Drinks data set in which the Age variable is a numeric variable.
1 In the main UNICOM Intelligence Reporter - Survey Tabulation window, select the Define tab.
2 In the Variable List, select the Gender variable.
3 From the Variables menu, choose Copy.
This creates a copy of the Gender variable and opens the New Variable dialog box: see New Variable dialog box. The Gender variable will define the base for the new variable.
4 Enter the Name for the new variable as Demographics.
5 In the Label text box, enter a description for the new variable as you want it to appear on your tables. For example, enter Demographic breakdown.
6 From the menu at the top of the Edit tab, choose Insert.
This opens the Insert Item dialog box: see Insert Item dialog box.
7 In the list of Available Items, select User Defined Category.
8 Click Add.
9 Repeat the last two steps two times, so that the User Defined Category item appears three times in the list on the right side of the dialog box.
10 Click OK.
This inserts three new items in the list on the Edit tab in the New Variable dialog box.
11 Select these three new items and then click Move Down repeatedly until they appear below the Female category.
12 Now use the first of these new items to create a "Young" band based on the Age variable like this:
Select the first of the new items and change its label to Young.
With the Young item still selected, click the Edit item link. This opens the Edit Category Dialog Box: see Edit Category dialog box.
In the Variable List, select the Age variable.
In the drop-down list on the right side of the Edit Category dialog, select Between.
Enter 1 in the first text box and 30 in the second text box.
Click OK.
13 Repeat these steps for the next new item, but enter the label as Middle and the values in the text boxes as 30 and 50.
14 Repeat these steps for the final new item, but enter the label as Old and the values in the text boxes as 50 and 100.
15 Click OK.
Note This example starts by using the Copy option to copy the categorical Gender variable. If you wanted to create a categorical banner variable that merges two categorical variables and a numeric variable, you would typically start by using the Merge option instead of copying just one of them as described above. However, the subsequent steps for adding the derived categories based on the numeric variable would be the same.
See also
Creating variables