Creating Bar Charts with Means by Category

One of the most common research questions is do different groups have different mean scores on some variable? This question is best answered in 3 steps: create a table showing mean scores per group -you’ll probably want to include the frequencies and standard deviations as well; create a chart showing mean scores per group; run some statistical test –ANOVA in this case. However, this […]

SPSS ALTER TYPE Reporting Wrong Values?

In some cases, ALTER TYPE in SPSS version 24 seems to report incorrect altered values when converting a string to a numeric value. This results in messed up data while SPSS reports that everything is fine. Let’s try and replicate the problem with the example below. Example We imported some .csv data in which some numeric values were flagged with an “a”. This indicates […]

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? […]

Combine Categorical Variables

Many easy options have been proposed for combining the values of categorical variables in SPSS. However, the real information is usually in the value labels instead of the values. This tutorial proposes a simple trick for combining categorical variables and automatically applying correct value labels to the result. SPSS Combine Categorical Variables Example You may follow along by downloading and opening hospital.sav. Now say […]

SPSS – Merge Categories of Categorical Variable

Summary Merging some categories of a categorical variable in SPSS is not hard if you do it the right way. This tutorial demonstrates just that. We recommend you try the examples for yourself by downloading and opening hotel_evaluation.sav. Right, when doing a routine inspection of this data file, we’ll see that the variable nation has many small categories. This becomes apparent when […]

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 […]

SPSS Scratch Variables

Definition Scratch variables are temporary helper variables that don’t show up in your data. A variable is a scratch variable if (and only if) its name starts with “#”. SPSS Scratch Variable – Introduction Say we have a data file holding phone numbers. Now we’d like to extract the area codes into a separate variable. […]

Regression over Many Dependent Variables

“I have a data file on which I’d like to carry out several regression analyses. I have four dependent variables, v1 through v4. The independent variables (v5 through v14) are the same for all analyses. How can I carry out these four analyses in an efficient way that would also work for 100 dependent variables?” […]

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 – Splitting a String Variable

After importing some data into SPSS, some answers ended up in a single string variable. The data are in splitstrings.sav, part of which is shown below. Excel has a nice “text to columns” function to split it but SPSS hasn’t…So you think you can syntax?Then let’s go and split this string into the original answers. Step 1 – New […]

SPSS Clone Variables Tool

In SPSS, I don’t like to recode variables into new variables: the new variables don’t have any dictionary information such as variable/value labels or formats. Second, a recoded variable is appended to the end of the file but I rather have it in its original position. Both problems are avoided by recoding into the same variables. However, […]

Comparing Dichotomous or Categorical Variables

Summary This tutorial shows how to create nice tables and charts for comparing multiple dichotomous or categorical variables. We recommend following along by downloading and opening freelancers.sav. The question we’ll answer is in which sectors our respondents have been working and to what extent this has been changing over the years 2010 through 2014. Variables sector_2010 through sector_2014 contain the necessary information. SPSS Frequency […]

Comparing Dichotomous Variables

This tutorial shows how to create nice tables and charts for comparing multiple dichotomous variables. If statistical assumptions are satisfied, these may be followed up by a McNemar test (2 variables) or a Cochran Q test (3+ variables). We’ll use the freelancers.sav data throughout. SPSS DESCRIPTIVES Table The simplest way to compare multiple dichotomous variables is simply running DESCRIPTIVES: as long as […]

Analyzing Categorical Variables Separately

When analyzing your data, you sometimes just want to gain some insight into variables separately. The first step in doing so is creating appropriate tables and charts. This tutorial shows how to do so for dichotomous or categorical variables. We recommend you follow along by downloading and opening smartphone_users.sav. SPSS Frequency Tables We’d like to know which smartphone brands were […]

Descriptive Statistics – One Categorical Variable

Introduction When reporting on data, we usually summarize our variables. The most basic way for doing so is presenting their frequency distributions. Visualizing these as histograms tends to give immediate insight into what a variable ‘looks like’, especially when many distinct values are present. However, frequency distributions often provide more detail than we actually need. […]

Association between Categorical Variables

This tutorial walks through running nice tables and charts for investigating the association between categorical or dichotomous variables. If statistical assumptions are met, these may be followed up by a chi-square test. As an example, we’ll see whether sector_2010 and sector_2011 in freelancers.sav are associated in any way. SPSS Quick Data Check Before doing anything else, let’s first just take a quick […]

SPSS Numeric Variables Basics

Introduction Having a basic understanding of SPSS numeric variables allows you to work fast and with a sense of confidence. This tutorial aims at accomplishing just that by pointing out some essential basics. You may follow along with this tutorial by downloading and opening hospital.sav. SPSS Numeric Variables – What Are They? Numeric variables are one of […]

SPSS Create Dummy Variables Tool

Summary Creating dummy variables for several categorical variables by basic syntax is usually not hard. However, applying proper variable labels to the newly created dummy variables requires quite a bit of effort. The tool presented in this tutorial will take care of this -and some other issues- more easily. SPSS Dummy Variables Tool SPSS Create Dummy Variables Tool Instructions […]

Creating Dummy Variables in SPSS

Dummy coding a variable means representing each of its values by a separate dichotomous variable. These so-called dummy variables contain only ones and zeroes (and sometimes missing values). The figure below shows how the variable “pet” from favorite_pets.sav has been dummy coded as pet_d1 through pet_d4. Dummy Variables in SPSS Note that, for example, pet_d2 represents the value 2 on […]

SPSS String Variables Basics

For working proficiently with SPSS string variables , it greatly helps to understand some string basics. This tutorial explains what SPSS string variables are and demonstrates their main properties. We encourage you along by downloading and opening string_basics.sav. The syntax we use can be copy-pasted or downloaded here. SPSS String Variables – What Are They? String variables are one […]