SPSS – What’s the Best Way to Reverse Code Variables?

In SPSS, we sometimes encounter variables that are negatively coded: lower values indicate higher agreement or more positive sentiments. Although this is not really “wrong” in any way, positive coding is more intuitive. Especially when reporting means over variables, most readers naturally expect higher means to indicate something better, not worse. So what’s the best way to reverse code variables? […]

SPSS Transformation Commands

Summary SPSS transformation commands (or simply “transformations”) can be loosely defined as commands that are not immediately carried out when you run them. Instead, they are kept in mind by SPSS and executed only when necessary. The table below gives an overview of SPSS’ main tranformation commands. Main SPSS Tranformation Commands COMMAND NAME GOAL TYPICAL USAGE […]

SPSS RANGE Function – Quick Tutorial

COMPUTE v2 = RANGE(V1,2,4). SPSS RANGE Function Result Summary SPSS’ RANGE function is used to evaluate whether or not values are within a given range. Test values equal to the lower or upper boundary are also within the given range. Run the syntax below for a quick demonstration. SPSS Range Syntax Example *1. Create couple of cases. data list free/v1(f1). begin […]

Recoding Variables in SPSS

Recoding both string and numeric variables in SPSS is usually done with RECODE. Doing so with syntax is way faster than with the menu, especially if you want to recode many variables at once. Note that you’ll often want to apply or adjust some value labels after recoding.Alternatively, string variables can be recoded into numeric variables with AUTORECODE. Doing […]

Remove Value Label from Multiple Variables

Question “I’d like to completely remove the value label from a value for many variables at once. Is there an easy way to accomplish that?” SPSS Python Syntax Example begin program. variables = ‘v1 to v5‘ # Specify variables here. value = 3 # Specify value to unlabel here. import spss,spssaux vDict = spssaux.VariableDict(caseless = True) varList […]

SPSS INSERT Command

Definition SPSS Insert is a command for running syntax files from within another syntax file. This may help keeping your syntax organized. SPSS Insert Command – Why Use It? Executing all of your commands from syntax may be the single best practice for working with SPSS. One of the reasons is that you can correct steps early […]

SPSS AUTORECODE Command

SPSS AUTORECODE – Minimal Example autorecode str_var1 str_var2 str_var3 /into num_var1 num_var2 num_var3. Introduction This tutorial explains SPSS’ AUTORECODE command and shows how to use it properly on nominal_strings.sav, a screenshot of which is shown below. We recommend downloading this data file and following along with the steps in this tutorial. SPSS AUTORECODE – What Is It? […]

SPSS Recode Values with Value Labels

Introduction In SPSS we sometimes find ordinal variables where lower values indicate more positive attitudes or larger quantities. An example is shown in the screenshot below. Now, the coding scheme shown above is not really ‘wrong’ in any way. However, we usually prefer higher values indicating more positive attitudes or larger quantities because we find this more […]

SPSS RANK Command

Summary SPSS RANK can be used to create a variable holding the rank numbers of the values of some other variable. RANK is also used for discretizing continuous variables into ntile groups. This tutorial walks you through the main options along with some real world examples. Result of first RANK syntax example 1. SPSS Rank Basic Example Running the syntax below first creates […]

SPSS MEANS – Statistics by Category

Summary SPSS MEANS produces tables containing means and/or other statistics for different groups of cases. These groups are defined by one or more categorical variables. If assumptions are met, MEANS can be followed up by an ANOVA. This tutorial walks through its main options, pointing out some tips and tricks. You may follow along by downloading and opening freelancers.sav. […]

SPSS DESCRIPTIVES Command

Summary SPSS DESCRIPTIVES generates a single table with descriptive statistics for one or more variables. It can also add z-scores to your data. We’ll walk through its major options using freelancers.sav. The screenshot below shows part of its data view. User Missing Values Before running any descriptives, we first need to specify some user missing values for income_2010 through […]

How to Compute Age in SPSS?

A course was evaluated by 183 students. The data are in course_evaluation.sav, part of which is shown below. The teacher wants to know the average age of his students but we only have their date of birth. 1. Ensure Date of Birth is a Date Variable The first thing we’ll do is check if date of […]

SPSS RECODE – Simple Tutorial

SPSS RECODE replaces data values with different values. It comes in handy for merging categories, dichotomizing continuous variables and some other tasks. This tutorial walks you through its main options, best practices and pitfalls. SPSS Recode Example 1 For quickly getting very proficient with RECODE it’s recommended you follow along with the examples. You’ll soon notice […]

SPSS Syntax Introduction

SPSS” Syntax Editor window is the second of SPSS’ three main windows. As we’ll see in a minute, this is where we run commands for opening files, editing data, generating results and, finally, saving files. The Syntax Editor is recognized by an orange icon  in its left top corner. SPSS Syntax – First Encounter We recommend […]