ARCHIVED: In SPSS, how can I calculate age from birthdate data?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

In SPSS, you can use the DATE function to calculate age from birthdate data, but the exact commands depend upon the format of the birthdate.

The following examples present three formats for birthdate data:

  • You may have entered the birthdate data using the following commands with American date format (i.e., mm/dd/yy):
    DATA LIST FIXED / birthday 1-8 (ADATE).
  • Alternatively, you may have used international date format (dd/mmm/yy, e.g., 22/dec/75) with this command:
    DATA LIST FIXED/ birthday 1-9 (DATE).
  • Finally, you may have entered month, day, and year into three separate variables. If so, you can generate the birthday variable as follows:
    COMPUTE birthday = DATE.MDY(month,day,year).

Regardless of how you entered the data, you now have a defined variable called birthday (following the examples above). The following example shows how to calculate the current age using April 04, 2012, as today's date:

COMPUTE age=DATE.MDY(04,04,2012)-birthday. 

The resulting value of age is the number of seconds from the date of birth to the date specified. If you need to find the age in years, compute a new variable (e.g., age_yr) using the following command:

COMPUTE age_yr=age / (365.25*24*60*60). 

SPSS defines date data as floating numbers representing the number of seconds from midnight, October 14, 1582, to the date specified.

If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.

This is document acya in the Knowledge Base.
Last modified on 2018-01-18 10:41:46.