DATA Step, Macro, Functions and more

date handling below year 1582

Occasional Contributor
Posts: 14

date handling below year 1582

[ Edited ]
Hi Guys, Please help me out how to handle date below 1582.Its populating missing value whenever date is below 1582 year.
Super User
Posts: 10,278

Re: date handling below year 1582

In SAS, you can't.

SAS date and datetime formats do not accept numbers that point to a year before 1582.

It is also impossible to declare a date or datetime constant before 1582.

Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Posts: 9,371

Re: date handling below year 1582

From the doc:

"Note: SAS date values are valid for dates based on the Gregorian calendar from A.D. 1582 through A.D. 19,900. Use caution when working with historical dates. Although the Gregorian calendar was used throughout most of Europe from 1582, Great Britain and the American colonies did not adopt the calendar until 1752."

If you need to store dates outside of the acceptable range, then you might need to store them as character strings or as separate MONTH, DAY and YEAR numeric variables.


ps -- this is an interesting user group presentation with more info/comments about dates:
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation