Friday, September 28, 2007

Leap Year

I work on SAS and Teradata. Some kind of databases. I was reading data from Teradata into SAS and figured out that dates or leap years to be precise are treated differently on both systems. To my surprise, year 4000, 8000 or years divisible 4000 are not leap years in SAS but they are in Teradata. I could find a fix but then I 'wiki'fied leap year and found this.

The Gregorian calendar, the current standard calendar in most of the world, adds a 29th day to February in all years evenly divisible by four, except for centennial years (those ending in -00), which receive the extra day only if they are evenly divisible by 400. Thus 1600, 2000 and 2400 are leap years but 1700, 1800, 1900, 2100, 2200 and 2300 are not. If the Year qualifies the following condition then its a leap year (Wikipedia)


(Year mod 4 = 0 AND Year mod 100 <> 0 ) OR Year mod 400 = 0


By this logic year 4000 and 8000 do qualify as leap years. Should I open a ticket against SAS? ;-)

No comments: