• 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

recode

Recoding a Variable from a Survey Question to Use in a Statistical Model

by Jeff Meyer Leave a Comment

Survey questions are often structured without regard for ease of use within a statistical model.

Take for example a survey done by the Centers for Disease Control (CDC) regarding child births in the U.S. One of the variables in the data set is “interval since last pregnancy”. Here is a histogram of the results.

[Read more…] about Recoding a Variable from a Survey Question to Use in a Statistical Model

Tagged With: categorical predictor, continuous predictor, predictor variable, recode, survey, survey questions

Related Posts

  • A Strategy for Converting a Continuous to a Categorical Predictor
  • A Useful Graph for Interpreting Interactions between Continuous Variables
  • Should I Specify a Model Predictor as Categorical or Continuous?
  • The Impact of Removing the Constant from a Regression Model: The Categorical Case

Stata Loops and Macros for Large Data Sets: Quickly Finding Needles in the Hay Stack

by Jeff Meyer 1 Comment

by Jeff Meyer

I recently opened a very  large data set titled “1998 California Work and Health Survey” compiled by the Institute for Health Policy Studies at the University of California, San Francisco. There are 1,771 observations and 345 variables. [Read more…] about Stata Loops and Macros for Large Data Sets: Quickly Finding Needles in the Hay Stack

Tagged With: compact, recode, Stata, SUMMARIZE

Related Posts

  • Using the Collapse Command in Stata
  • Tricks for Using Word to Make Statistical Syntax Easier
  • Using the Same Sample for Different Models in Stata
  • Using Stored Calculations in Stata to Center Predictors: an Example

R Is Not So Hard! A Tutorial, Part 18: Re-Coding Values

by guest 5 Comments

by David Lillis, Ph.D.

One data manipulation task that you need to do in pretty much any data analysis is recode data.  It’s almost never the case that the data are set up exactly the way you need them for your analysis.

In R, you can re-code an entire vector or array at once. To illustrate, let’s set up a vector that has missing values.

A <- c(3, 2, NA, 5, 3, 7, NA, NA, 5, 2, 6)

A

[1] 3 2 NA 5 3 7 NA NA 5 2 6

We can re-code all missing values by another number (such as zero) as follows: [Read more…] about R Is Not So Hard! A Tutorial, Part 18: Re-Coding Values

Tagged With: data cleaning, R, recode

Related Posts

  • R Is Not So Hard! A Tutorial, Part 9: Sub-setting
  • R Is Not So Hard! A Tutorial, Part 8: Basic Commands
  • R is Not So Hard! A Tutorial, Part 22: Creating and Customizing Scatter Plots
  • R is Not So Hard! A Tutorial, Part 21: Pearson and Spearman Correlation

An Easy Way to Reverse Code Scale items

by Karen Grace-Martin 27 Comments

Before you run a Cronbach’s alpha or factor analysis on scale items, it’s generally a good idea to reverse code items that are negatively worded so that a high value indicates the same type of response on every item.

So for example let’s say you have 20 items each on a 1 to 7 scale. For most items, a 7 may indicate a positive attitude toward some issue, but for a few items, a 1 indicates a positive attitude.

I want to show you a very quick and easy way to reverse code them using a single command line. This works in any software. [Read more…] about An Easy Way to Reverse Code Scale items

Tagged With: recode, reverse coding, SAS, SPSS

Related Posts

  • Statistical Software Access From Home
  • Member Training: What’s the Best Statistical Package for You?
  • Tricks for Using Word to Make Statistical Syntax Easier
  • Ten Ways Learning a Statistical Software Package is Like Learning a New Language

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. [Read more…] about Recoding Variables in SPSS Menus and Syntax

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

Primary Sidebar

This Month’s Statistically Speaking Live Training

  • January Member Training: A Gentle Introduction To Random Slopes In Multilevel Models

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.