How to Recode into Existing or New Variables
This post shows how to use Displayr to replicate the standard SPSS functions of Transform > Recode into Same Variables and Transform > Recode into Different Variables.
If you come from an SPSS background, the way that recoding works in Displayr will, at first, seem rather odd. However, once you understand it you will find it saves you a lot of time and pain.
This post is broken into five sections:
- 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
Recoding into the same variable to compute a mean
Step 1: Ensuring you have a numeric structure
Let's say you wanted to compute the average age. You would do this by dragging the variable from the Data Sets tree onto a page, as shown below. If percentages appear, as shown below, you need to click on the variable in the Data Sets tree and change the structure (Properties > INPUTS > Structure, on the right of the screen) to Numeric.
If the structure of the variable is Numeric, Displayr will instead compute an average.
Step 2: Setting the values
Click on the variable in the Data Sets tree and click Properties > DATA VALUES > Values and enter the desired values (you can also copy and paste using the Export and Import buttons).
If you wish to recode lots of variables at the same time, just select them all and then click the Values button.
Merging categories to compute a percentage
In many data analysis programs, the data is recoded as a way of merging categories. This is not how Displayr works. In Displayr, you can merge together categories by clicking on them and, dragging the grey box with the three dark lines onto another category. The merging and the values are completely independent (when you merge it does not affect the values and recoding the values has no impact on the merging of categories).
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:
- Selecting the variable set
- Choosing Properties > INPUTS > Structure and Binary Multi: Non-Mutually Exclusive Categories (the option a the top of the list)
- Press the Fix button that will appear at the top, that appropriate choices have been selected in the Count this Value column, and pressing OK.
Recoding into different variables
To duplicate data, select it in the Data Sets tree and click Home > Duplicate.
Displayr has a number of inbuilt tools for automatically recoding data. For example:
- Insert > Transform (Variables) > Midpoint Coding and Quantification automatically duplicates variables, makes them numeric, and infers midpoints by reading the labels.
- Insert > Transform (Variables) > Top 2 Category Variables (That is, Top 2 Boxes) automatically creates top 2 box scores.