Leapyears are every four years EXCEPT for century years which are only leapyears if they are divisible by 400. So, 2012 is a leap year (divisible by 4), 1900 was not a leapyear (it was a century year but was not divisible by 400), 2000 was a leapyear (century year divisible by 400).
Although --- this is a bit off topic by now, since I'm fairly certain that darrylovia's answer means that treating the days before 1582 as if they came from current-day calendar practices is essentially wrong ... I thought I'd share my leap year code logic (operates on the year in four digits ... so you'd need to get the year from the SAS date value first):
/* The following is the beginning snippet of code that defines a year as a leap year */
IF (MOD(YEAR,100) NE 0 AND MOD(YEAR,4) EQ 0) OR (MOD(YEAR,400) EQ 0) THEN
... I think this handles when leap years occur in the modern calendar.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: