Chapter 13: Working with SAS Dates

Introduction

Reading Dates from Text Data

Creating a SAS Date from Month, Day, and Year Values

Describing a Date Constant

Extracting the Day of the Week, Day of the Month, and Year from a SAS Date

Adding a Format to the Bar Chart

Computing Age from Date of Birth: The YRDIF Function

Conclusion

Problems

Introduction

SAS can read and write dates in almost any format, such as 5/23/2015 or 23May2015. No matter how the date appears in the input file, SAS converts all dates to the number of days from January 1, 1960. Thus, January 1, 1960, is 0; January 2, 1960, is a 1; and so on. Dates before January 1, 1960, are converted to negative numbers. For example, December 31, 1959, is equal to -1. Almost all computer languages ...

Get An Introduction to SAS University 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.