Chapter 8: Tasks Involving Dates

Introduction

Task: Computing a person's age, given his or her date of birth

Task: Computing a SAS date given a month, day, and year (even if theday value is missing)

Conclusion

Introduction

This short chapter includes one of the most common tasks—computing a person's age given a date of birth. Another task discussed is how to compute a SAS date given a month, day, and year. To make the task a bit more interesting, the program presented here uses the 15th day of the month to compute the date if month is a missing value. Let's get started.

Task: Computing a person's age, given his or her date of birth

Keywords

Age computation

YRDIF function

TODAY function

For this task, you want to compute a person's age as of ...

Get Cody's Collection of Popular SAS Programming Tasks and How to Tackle Them 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.