Date Variables

SPSS Date Calculation Example

In SPSS, a date is the number of seconds since the year 1582. These are huge numbers but they are still just numbers like somebody’s weight in kilos or the number of cars in some household. The main difference between dates and other variables is that SPSS displays dates with slashes or dots as in “2016/11/07”.
Once you fully realize this, you'll also realize that SPSS date calculations are just as simple as any other calculations. The main challenge, converting normal dates into numbers of seconds, is taken care of by simple date functions such as DATEDIFF (number of time units such as days between dates) or DATESUM (add time units such as years to some date).
Study the first two tutorials below and you'll work with SPSS date variables fast, precisely and confidently. Enjoy!


SPSS Date Calculations

SPSS Date Variables Basics

SPSS date variables are not hard to work with if you understand some basics. This tutorial walks you through them by showing some simple data examples. Read More

SPSS Date Variables Tutorial

SPSS date calculations are much easier than they may seem at first. The first key to success is understanding what SPSS date variables really are. Next, choose (and possibly combine) the right date functions. This tutorial will walk you through the main ones. Read More

SPSS Date Conversions

Convert Google Analytics Dates into SPSS Dates

Data exported from Google Analytics may use a nicely readable date format (such as "Sunday, January 30, 2006"). This format, however, is not suitable for time calculations. This tutorial shows how to convert it into a proper SPSS Date Variable. Read More

Convert Numeric to Date Variable

For time calculations (such as the number of days between two dates) proper date variables are needed. In some cases, the digits of a numeric variable may represent year, month and day. This tutorial shows how to convert this format into an actual date variable. Read More

Convert Unix Dates into SPSS Dates

Dates in Unix format may enter SPSS in two flavors: as a string (for example "2011-06-20 18:15:08" from Google Analytics) or as a number ("1382064174"). These formats are easily converted to SPSS datetime variables when using the right tools. Read More

Extract a Year from a Date

Extracting the year (or any component) from a date is straightforward with the XDATE function. Read More


Convert String to Date Variable

For converting string variables to date variables, ALTER TYPE is the way to go. This tutorial demonstrates how to do this and points out a couple of caveats. For those who can't use ALTER TYPE, we'll propose some alternatives. Read More

How to Compute Age in SPSS?

In some cases, one would like to calculate respondents' age given their birthday. As long as birthday is an actual date variable, age is readily calculated by using the DATEDIFF function. Read More

Convert String Date to SPSS Date Variable

Converting a string variable into an SPSS date variable isn’t hard if you combine the right tools. Step-by-step tutorial with downloadable data file. Read More