SPSS Datetime Variables Tutorial

Introduction This tutorial shows how to work proficiently with SPSS datetime variables. You can follow along with it by downloading and opening hospital.sav. SPSS Main Datetime Functions This tutorial will cover the datetime functions outlined in the table below. Most of them apply to SPSS date variables and time variables as well because their values are stored in numbers of […]

Disaggregate Data

Introduction Sometimes, one may start a project with aggregated data, weighted by a frequency variable. In some cases, though, disaggregating such data (creating n rows for a row with frequency n) may be desired. SPSS Syntax Example *1. Create test data. data list free/gender employed frequency. begin data 0 0 5 1 0 2 0 1 8 1 […]

SPSS – Batch Process Files with Python

Running syntax over several SPSS data files in one go is fairly easy. If we use SPSS with Python we don’t even have to type in the file names. The Python os (for operating system) module will do it for us. Try it for yourself by downloading spssfiles.zip. Unzip these files into d:\spssfiles as shown below and you’re good to go. Find All Files […]

SPSS Python Examples

Learn Python for SPSS the right way by running some of the examples below. They show precisely how to get things done in SPSS the fastest way possible and are easily modified to suit your needs. Enjoy! Latest SPSS Python Examples Batch Process Files with Python Create Several Excel Files with Python Change Value Labels with Python SPSS with […]

SPSS RTRIM Function

Summary By default, SPSS right pads string values with spaces up to the length of their containing string variables. You don’t usually see this but it may complicate concatenating strings. Such complications are avoided by trimming off trailing spaces using RTRIM (right trim). In Unicode mode, RTRIM is applied automatically but it’s fine to use it anyway. Results of steps 6 and 7 of the […]

Python for SPSS

Python is a programming language that can be integrated with SPSS versions 14 and higher. By using Python in SPSS you can automate basically any SPSS task such as batch processing data files or output tables and charts. Recent SPSS versions allow you to add SPSS extensions similarly to apps on a smartphone. Most extensions can be used from […]

SPSS Data Preparation 6 – Inspect Cases

9. Missing Values per Case (Overview and data file are are found here) Missing values complicate some analyses or may sometimes indicate that respondents didn’t fill out the questionnaire very seriously. In any case, it’s a good idea to at least check how missing values are distributed over respondents and we often do so for sections […]

SPSS Data Preparation 4 – Specify Missing Values

5. Presence of User Missing Values (Overview and data file are are found here) User missing values are values that we want to exclude from analysis. We do so by specifying (ranges of) values as “missing” in SPSS. For ordinal variables, we typically exclude answers such as “Don’t know” or “Not applicable”. For metric variables, we exclude values that are not […]

SPSS Datetime Variables Basics

Introduction Working with SPSS datetime variables is not hard at all if you understand some basics. This tutorial walks you through just those. Those who’d like to follow along may download and open hospital.sav. SPSS Datetime Variables – What Are They? SPSS datetime variables are variables that hold the numbers of seconds between the year 1582 and […]