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
birthdayvariable 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:
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:
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.
Last modified on January 21, 2011.







