Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

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

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 / birthday 1-8 (ADATE). BEGIN DATA 12/22/75 01/08/65 . . END DATA.
  • Alternatively, you may have used international date format (dd/mmm/yy, e.g., 22/dec/75) with this command: DATA LIST / 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 July 29, 2009, as today's date:

COMPUTE age = DATE.MDY(07,29,09) - 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.

For more about statistical and mathematical software, email the UITS Stat/Math Center, visit the center's web page, or phone 812-855-4724 (IUB) or 317-278-4740 (IUPUI). The center is located in Bloomington at 410 N. Park Avenue, and is open for consultation by appointment Monday-Friday 9am-5pm.

This is document acya in domain all.
Last modified on January 21, 2011.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.