4 Working with Dates

Introduction

Checking Ranges for Dates (Using a DATA Step)

Checking Ranges for Dates (Using PROC PRINT)

Checking for Invalid Dates

Working with Dates in Nonstandard Form

Creating a SAS Date When the Day of the Month Is Missing

Suspending Error Checking for Known Invalid Dates

Introduction

SAS dates seem mysterious to many people, but by understanding how SAS dates are stored, you will see that they are really quite simple. SAS dates are stored as numeric variables and represent the number of days from a fixed point in time, January 1, 1960. The confusion develops in the many ways that SAS software can read and write dates. Typically, dates are read as MM/DD/YYYY or some similar form. There are informats to read almost any ...

Get Cody's Data Cleaning Techniques Using SAS, 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.