O'Reilly logo

An Introduction to SAS University Edition by Ron Cody

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required