SPSS tutorials website header logo SPSS TUTORIALS VIDEO COURSE BASICS ANOVA REGRESSION FACTOR

SPSS with Python – Basics

SPSS Python - Write Shorter Syntax

SPSS Python Introduction

Python for SPSS – What is It?

Some larger or more complex SPSS tasks may seem daunting at first. However, they can usually be accomplished with surprisingly little time and effort. The basic trick here is to have Python create and execute the necessary syntax for you. This tutorial briefly introduces Python and its relation to SPSS.


Read more...

Python for SPSS – How to Use It?

We can run Python code straight from SPSS’ syntax window. However, there's more efficient and user friendly options too. This lesson walks you through.


Read more...

Main Differences Python and SPSS Syntax

SPSS users who want to speed up their work by using Python will encounter some surprises. This tutorial walks you through the 5 major pitfalls and shows how to avoid them.


Read more...

SPSS Python Examples - Basic

Sort Variables in SPSS with Python

One of the most basic SPSS Python tasks is looking up variable names and inserting them into SPSS syntax. This lesson covers the easiest option for doing so.


Read more...

Set SPSS Variable Names as Labels with Python

Some data files have very long variable names but no variable labels. We like setting such names as variable labels. We'll then give our variables nice and short names.


Read more...

Looping over SPSS Commands with Python

SPSS offers some ways for looping over variables. These can't handle a lot of scenarios but -fortunately- Python can. This lesson walks you through a nice example.


Read more...

SPSS – Edit Value Labels with Python

Python can easily read SPSS value labels and correct them. This lesson shows how to do so by working with a Python dict object.


Read more...

SPSS – Extract ISO Weeks from Date Variable

This tutorial demonstrates how to easily extract the ISO year, week and day from an SPSS date variable with the SPSSINC TRANS extension.


Read more...

SPSS Python Examples - Intermediate

Process Multiple SPSS Data Files with Python

Running syntax on several SPSS data files in one go is fairly easy with Python. This tutorial walks you through.


Read more...

SPSS – Create New Files with Python

We'll look up SPSS data values with the Python spssdata module. We'll then have Python insert the values into SPSS syntax and create several Excel files.


Read more...

SPSS – Delete Selection of Variables with Python

In this lesson we'll develop a simple Python routine for deleting all variables having too many missing values. We'll look up raw data values with the spssdata module.


Read more...

SPSS – Cloning Variables with Python

In this lesson, we'll develop an SPSS Python module for cloning variables. Our basic approach readily generalizes to a myriad of other SPSS routines.


Read more...

SPSS Python String Tutorials

Overview Python String Methods

Quick overview of Python string methods: extracting substrings, replacing characters, finding indices and much more with simple examples.


Read more...

Python Text Replacements Tutorial & Examples

Quick overview of different methods for making text replacements in Python with explanations and examples.


Read more...

Python Reference Tutorials

Quick Overview Python Object Types

This lesson presents an overview of the most important Python object types. We'll also highlight some of our objects’ main methods.


Read more...

Python Operators – Quick Overview & Examples

Quick overview of all Python operators.

Operators that are very specific to Python are demonstrated with one or more short examples.


Read more...

Quick Overview SPSS Python Modules

This lesson presents an overview of the most important modules for using Python in SPSS. We'll also cover each module’s main functions.


Read more...

Conditions and Loops in Python

Two very common parts of any computer language are conditions and loops. This lesson quickly walks you through some examples for using them in Python.


Read more...

SPSS Python II Examples

Apply Dictionary Information from Excel

"I have an Excel workbook whose three sheets contain data values, variable labels and value labels. How can I apply the dictionary information from these last two sheets to the SPSS dataset after importing the data values?"


Read more...

SPSS – Batch Process Files with Python

Running syntax on several SPSS data files in one go is fairly easy with Python. This tutorial walks you through.


Read more...

Move all Files from Subfolders to Main Folder

"I'd like to work with a number of .sav files but they are scattered over different folders. All file names are unique. Is there any easy way to search through a number of folders for .sav files and move these into some root directory?"


Read more...

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?"


Read more...

Suffix All Variable Names

I have a data file in which all variables were measured in 2012. I'd like to suffix their names with "_2012". What's the easiest way to do this?


Read more...

SPSS with Python – Looping over Scatterplots

For running SPSS tables or charts over many variables, an SPSS Python loop is the right way to go. We'll demonstrate some examples for doing so.


Read more...

Search Syntax Files for Expression

"I found a variable "v_4" in an old data file and I can't remember how exactly I created it. The syntax I used got a bit messy, I have different files and they're in different folders. Is there an easy way to find out which syntax files contain the expression "v_4"?"


Read more...

Split String Variable into Components

"I have a long string variable in my data that actually holds the answers to several questions. These are separated by a semicolon (";"). How can I split this variable into the original answers?"
Read more...

Create Dictionary Dataset

An often requested feature is to export variable and value labels to Excel. This handy tool creates an SPSS Dataset containing these labels. It can either be be saved as an Excel sheet or further edited in SPSS.


Read more...

Remove Value Label from Multiple Variables

"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?"


Read more...

Tell us what you think!

*Required field. Your comment will show up after approval from a moderator.

THIS TUTORIAL HAS 11 COMMENTS: