Date calculations in SPSS

Steve Simon

1999-08-18

Categories: Blog post Tags: Data management SPSS software

*Dear Professor Mean

Dear Stumped,

Maybe your patients were waiting for their HMO to approve a visit to a specialist.

Short explanation

**SPSS stores date/time values as the number of seconds since October 14

More details

To see what SPSS is doing

**To subtract one column of numbers from another in SPSS

If you are using dates

Example

A common example using dates is computing length of stay in the hospital.

The data shown above represents the birthdate (dob)

The figure shown above is the dialog box that you get. Type in a new name in the TARGET VARIABLE field. The formula for computing length of stay is

(datedsc-dateadm)/(246060)

which you should type into the NUMERIC EXPRESSION field. Then click on the OK button.

This figure shown above indicates that you have successfully computed length of stay as the difference between two date values. Congratulations.

Summary

Stumped Sharon is having problems with some calculations using dates in SPSS. Professor Mean explains that **SPSS stores data values as the number of seconds since October 14

Further reading

Raynald Levesque has a nice web tutorial about dates in SPSS.

  1. Dates Tutorial. Raynald Levesque. Accessed September 7

Update

I attended a web seminar on the new enhancements in version 13.0 of SPSS software. The most notable change is in date calculations.

Date and time variables in SPSS have always been difficult. I have a web page showing some of the issues involved with computing the difference between two dates. SPSS has now added a Data and Time Wizard. Select TRANSFORM | DATE/TIME from the menu. Here’s the first dialog box from that menu.

This is a very pleasant surprise

You can find an earlier version of this page on my original website.