Server User Guides > Survey Tabulation > Working with variables > Creating variables > Merging a categorical and a numeric variable
 
Merging a categorical and a numeric variable
Sometimes you might 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: see New Variable dialog. 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 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.
The Insert Item dialog opens: see Insert Item dialog.
7 In the list of Available Items, click User Defined Category, and then click Add.
8 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.
9 Click OK.
This inserts three new items in the list on the Edit tab in the New Variable dialog.
10 Select these three new items and then click Move Down repeatedly until they appear below the Female category.
11 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: see Edit Category dialog.
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 box and 30 in the second box.
Click OK.
12 Repeat these steps for the next new item, but enter the label as Middle and the values in the boxes as 30 and 50.
13 Repeat these steps for the final new item, but enter the label as Old and the values in the boxes as 50 and 100.
14 Click OK.
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 typically start by using the Merge option instead of copying just one of them. However, the subsequent steps for adding the derived categories based on the numeric variable are the same.
See also
Creating variables