• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
The Analysis Factor

The Analysis Factor

Statistical Consulting, Resources, and Statistics Workshops for Researchers

  • Home
  • About
    • Our Programs
    • Our Team
    • Our Core Values
    • Our Privacy Policy
    • Employment
    • Guest Instructors
  • Membership
    • Statistically Speaking Membership Program
    • Login
  • Workshops
    • Online Workshops
    • Login
  • Consulting
    • Statistical Consulting Services
    • Login
  • Free Webinars
  • Contact
  • Login

Recoding Variables in SPSS Menus and Syntax

by Karen Grace-Martin 90 Comments

SPSS offers two choices under the recode command: Into Same Variable and Into Different Variables.

The command Into Same Variable replaces existing data with new values, but the command Into Different Variables adds a new variable to the data set.

In almost every situation, you want to use Into Different Variables. Recoding Into Same Variables replaces the values in the existing variable.

So if you notice a mistake after you’ve recoded, you can’t fix it.

But you may not even notice the mistake, because you can’t even test it.

And that’s just dangerous.

So do not recode over an existing variable unless you are absolutely certain that the lost information will never be needed.

Here is an example of how to do it in the menus.  This is from the General Social Survey data set that comes along with SPSS.  In it, I am recoding Educ, Years of Education, into 5 categories: Less than High School, High School Grad, Some College, Bachelor’s degree, More than college.

Transform

Recode  Into Different Variables

This dialog window will come up:

I filled in the following:

Numeric variable: Educ

Output variable Name: Educ_Cat

Output variable Label: Education in Categories

Click Change

Click Old and New Values

This Dialogue Window will pop up:

Fill in the following:

Old Value: Range: Lowest Through: 11

New Value: Value: 1

Click Add

Old Value: Value 12

New Value: Value: 2

Click Add

Old Value: Range: 13 Through: 15

New Value: Value: 3

Click Add

Old Value: Value: 16

New Value: Value: 4

Click Add

Old Value: Range: 17 Through Highest

New Value: Value: 5

Click Add

Old Value: System- or User-Missing

New Value: System Missing

Click Continue

Click OK
Or, you could do all of that in just a few lines of very logical syntax code:

RECODE educ (12=2) (16=4) (MISSING=SYSMIS) (Lowest thru 11=1) (13 thru 15=3) (17 thru Highest=5) INTO Educ_cat.
VARIABLE LABELS  Educ_cat ‘Education in Categories’.
EXECUTE.

If you don’t have many variables to recode, say one or two, it’s not a big deal to use the menus (but at least paste the code, so you have a record of what you did later!).

But if you have more than just one or two, all those mouse-clicks get old, fast.

And if you need to go back and change your coding scheme, say to combine two small categories, it’s a quick matter to update the code.  In the menus you have to start over.

(And of course, once you recode, you should immediately enter value labels and test your syntax to make sure it worked.  Both are easy to do with syntax).

Want to learn more? If you’re just getting started with data analysis in SPSS, or would like a thorough refresher, please join us in our online workshop Introduction to Data Analysis in SPSS.


Bookmark and Share

Getting Started with SPSS Syntax
Do you want to know how to use SPSS syntax for data manipulation and analyses? You will witness all the advantages that come with using syntax, especially one that is already built-in.

Tagged With: recode, SPSS

Related Posts

  • Using Python with SPSS
  • How to Get a Code Book from SPSS
  • An Easy Way to Reverse Code Scale items
  • Using Case Summaries in SPSS to Debug your Variable Creation

Reader Interactions

Comments

  1. Mixi says

    August 18, 2017 at 7:16 pm

    1. Imported Data
    2. Recoded variables into new variables
    How do I add more data into the sheet?
    If I do a simple copy paste value is not being generated for the recoded variables. Help !!

    Reply
  2. Nummy says

    October 26, 2016 at 2:27 am

    hi
    i have spss sheet.and i make variable from different items now i have loss output file and dont know about the items of the variable. how i know about the items. variable are developed already…

    Reply
« Older Comments

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Please note that, due to the large number of comments submitted, any questions on problems related to a personal study/project will not be answered. We suggest joining Statistically Speaking, where you have access to a private forum and more resources 24/7.

Primary Sidebar

This Month’s Statistically Speaking Live Training

  • February Member Training: Choosing the Best Statistical Analysis

Upcoming Workshops

  • Logistic Regression for Binary, Ordinal, and Multinomial Outcomes (May 2021)
  • Introduction to Generalized Linear Mixed Models (May 2021)

Read Our Book



Data Analysis with SPSS
(4th Edition)

by Stephen Sweet and
Karen Grace-Martin

Statistical Resources by Topic

  • Fundamental Statistics
  • Effect Size Statistics, Power, and Sample Size Calculations
  • Analysis of Variance and Covariance
  • Linear Regression
  • Complex Surveys & Sampling
  • Count Regression Models
  • Logistic Regression
  • Missing Data
  • Mixed and Multilevel Models
  • Principal Component Analysis and Factor Analysis
  • Structural Equation Modeling
  • Survival Analysis and Event History Analysis
  • Data Analysis Practice and Skills
  • R
  • SPSS
  • Stata

Copyright © 2008–2021 The Analysis Factor, LLC. All rights reserved.
877-272-8096   Contact Us

The Analysis Factor uses cookies to ensure that we give you the best experience of our website. If you continue we assume that you consent to receive cookies on all websites from The Analysis Factor.
Continue Privacy Policy
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.

SAVE & ACCEPT