Tech Tips
Dummy Coding Variables
This Tech Tip shows how to create dummy variables in IBM SPSS Statistics. In IBM SPSS Statistics, you can work inside a single, integrated interface to run descriptive statistics, regression, advanced statistics, and machine learning models. You can create publication-ready charts, tables, and decision trees in one tool. IBM SPSS Statistics is easy to use, provides analysis automation, comprehensive statistical tools, integration with open source, and help at your fingertips.
If we have a categorical variable that we want to use as an independent variable in a linear regression model, we will need to create dummy variables. To create dummy variables, we create new variables from the categories.
For example, if we wanted to use self-reported happiness (three categories = very happy, pretty happy, not too happy) to predict hours per day spent watching TV, we would need to dummy code this variable. Two new variables are created called ‘very_happy’ and ‘pretty_happy’ with values of 0 and 1 representing whether respondents selected that option. The category ‘not too happy’ will be left out and serve as the reference category.
Creating dummy variables is easy in IBM SPSS Statistics. Users can go to the Transform menu and select Compute Variable to open the Compute Variable dialog box. Users can enter a new variable name in the Target Variable box and the expression in the Numeric Expression box. In this example, we will create a new variable called ‘very_happy’ where respondents receive a 1 if they indicated they were very happy or a 0 if they did not select this option. Users can then click OK to create the new variable. The same steps are used to create a new variable called ‘pretty_happy’.
Once the new variables are created, users can treat them as scale variables using the Variable View or the Define Variable Properties procedure.
Need some help?
Learn how to use SPSS from the experts
With more than 20 years of delivering highly successful training programs, Version 1 offers a wide range of training options to best suit your requirements, enabling you to optimise your IBM SPSS Software, achieve your analytical goals and continually improve your results.
Related Tech Tips
Our SPSS experts have created a range of Tech Tips for IBM SPSS Statistics. Take a look through.