Example 9.13 Calculating a Person's Age

Goal

Determine a person's age by using his or her date of birth.

Example Features

Featured StepDATA step
Featured Step Options and StatementsFLOOR and INTCK functions
A Closer LookMore about Calculating Ages and Anniversaries

Input Data Set

Data set MARCH_HIRES has the names and dates of birth for 10 employees hired on March 1, 2009. Variable DOB is a SAS date value. It is displayed with the WORDDATE20. format.

                 MARCH_HIRES

Obs    name                               dob 1 JK Allen March 1, 1972 2 RT Brown February 28, 1980 3 WI Carter March 29, 1980 4 LG Johnson March 1, 1980 5 MH Johnson December 12, 1980 6 PO Phillips February 14, 1971 7 TR Smith November 9, 1967 8 AG Rodriguez July 2, 1955 9 EW Washington July 30, 1960 10 NA Young ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.