This article describes how to to use Displayr to replicate the standard SPSS functions of Transform > Recode into Same Variables and Transform > Recode into Different Variables.
This includes:
- Recoding into the same variable to compute a mean
- Merging categories to compute a percentage
- The special case of binary variables (e.g. Top 2 Boxes)
- Recoding into different variables
- Automatic recoding
Requirements
- Familiarity with the Structure and Value Attributes of Variable Sets.
- A data set loaded into a Displayr document.
Please note these steps require a Displayr license.
Method
Recoding into the same variable to compute a mean
If the structure of the variable is Numeric or Numeric - Multi, Displayr will automatically compute an average. If the structure is Nominal, Nominal - Multi, Ordinal, or Ordinal - Multi, you will need to follow these steps:
- Select the variable in the Data Sources tree.
- Go to the object inspector on the right of your screen, and under Data > Properties > Structure change it to Numeric (or Numeric - Multi if the structure is Nominal - Multi or Ordinal - Multi).
- Select DATA VALUES > Values.
- In the Value column, you can enter the desired values and click OK. For instance, you might want to do this if you need to reverse the scales of a rating question, or enter a mid-point value for age.
- OPTIONAL: You can also copy and paste using the Export and Import buttons.
Merging categories to compute a percentage
- Drag the variable from the Data Sources tree onto the Page.
- Select the category(ies) in the table you want to merge and drag the grey box with three dark lines onto another category.
Merging categories does not change the original values of the variable. Merging categories and the values are completely independent. However, this will change the same categories in other tables and outputs, i.e., it will universally update the categories, as seen below:
If you prefer this not to happen, you will first need to duplicate the variable (via right-click Duplicate and then perform the merge in the new variable.
You can easily revert to the original categories by clicking the merged category and then selecting Split in the toolbar.
The special case of binary variables (e.g. Top 2 Boxes)
Survey data often contains sets of categorical variables that need to be recoded into binary variables. For example, with the six variables shown in the table below, it is common to recode this data to take a value of 1 if a person has selected Like or Love and 0 otherwise (i.e., a "Top 2 Box" score).
In Displayr, this is done by:
- Select the variable set in the Data Sources tree.
- In the object inspector on the right of your screen, update Data > Properties > Structure to Binary Multi: Non-Mutually Exclusive Categories.
- Press the Fix button that will appear above the object inspector. Ensure that the appropriate choices have been selected in the Count this Value column (eg, Like and Love).
- Press OK.
Automatic recoding
Create a Top 2 Box Variable
- Select the variable set in the Data Sources tree.
- Either hover over any variable in your Data Sources tree > Plus (+) > Ready-Made New Variable(s) > Top 2 Category Variable(s) (Top 2 Boxes) or else from the object inspector, go to Data > TRANSFORMATIONS > Top 2 Category Variable(s) (Top 2 Boxes).
- This automatically creates Top 2 Box scores by creating a new variable that shows the respondents who selected the top 2 responses.
- ALTERNATIVELY: From the toolbar, select Anything > Data > Variables > New > Ready-Made New Variable(s) > Top 2 Category Variable(s) (Top 2 Boxes).
NOTE: You can create Bottom 2 Box and Top K/Bottom K Box variables using this same method, but selecting the appropriate item from the Ready-Made New Variable(s) or TRANSFORMATIONS menus.
Create a variable that contains the mid-points
- Select the variable set in the Data Sources tree.
- Either hover over any variable in your Data Sources tree > Plus (+) > Ready-Made New Variable(s) > Numeric Variable(s) from Code/Category Midpoints or else from the object inspector, go to Data > TRANSFORMATIONS > Numeric Variable(s) from Code/Category Midpoints.
- This automatically duplicates the variable(s), makes them numeric, and infers midpoints by reading the labels.
- OPTIONALLY: Go to Anything > Data > Variables > Modify > Recode > Numeric Variable(s) from Code/Category Midpoints.
Recoding into different variables
To duplicate a variable, select it in the Data Sources tree, right-click, and select Duplicate.
Next
How to Recode Variables Using Category Midpoints
How to Recode Net Promoter Score (NPS) Variable(s)
How to Create Top Two Category Variable(s) (Top 2 Boxes)
How to Create Top Three Category Variable(s) (Top 3 Boxes)
How to Create Top K Category Variable(s) (Top K Boxes)
How to Create Bottom Two Category Variable(s) (Bottom 2 Boxes)
How to Create Bottom Three Category Variable(s) (Bottom 3 Boxes)
How to Create Bottom K Category Variable(s) (Bottom K Boxes)
How to Recode Low Values (Capping) in Numeric Variables
How to Recode High Values (Capping) in Numeric Variables
How to Recode Numeric Variable(s) from Code/Category Midpoints