There are times when the categories in a demographic question are more detailed than the ones you wish to use for your analysis, such as age groups of 18 to 24 and 25 to 29 instead of 18 to 29. It may also be the case that you want to combine or interlock categories from different questions, such as age and gender.
This article describes how to combine categories within and across variables...
...to create a mutually exclusive variable:
- A Document with a data set.
- Single categorical variables.
Method - Combine categories within a variable
1. Drag your variable from the Data Sets tree to your page. In this example, we will do this for our Age variable.
2. Select the row labels you wish to combine, while holding down CTRL, and press Combine in the toolbar. Here, we will select 18 to 24 and 25 to 29.
3. Select Rename in the toolbar. Here, we will enter 18 to 29.
4. Repeat steps 2 to 3 until you have the desired categories:
Note: It is important to note that using this method to combine categories only combines them on tables and charts, but does not change the not change the categories in the data which would be used in other analyses.
Method - Combine categories across variables
This method is for when you wish to create interlocking categories.
1. Go to Anything > Data > Variables > New > Custom Code > R - Text in the toolbar.
paste() under Properties > R CODE in the object inspector.
3. Drag the first variable (Gender) from your Data Sets tree so it is positioned inside the code brackets.
4. Enter a comma after this variable label.
5. Drag the second variable (Age) from your Data Sets tree so it is positioned inside the code brackets after the comma.
6. OPTIONAL: Repeat steps 3 to 5 if there are further variables.
7. Update Name and Label under GENERAL.
8. Change Structure to Nominal: Mutually exclusive categories. You will now have a variable that combines Gender and Age categories together.
How to Band Numeric Variables using a Table
How to Create New Binary Variable(s)
How to Create a Binary Filter from Selected Data
How to Use R's Paste Formulas in Displayr
Article is closed for comments.