Leap year

Accepted Solution Solved
Reply
Contributor
Posts: 21
Accepted Solution

Leap year

Please help answer the following: I am trying to create a data set that will only contain leap years between two chosen dates.

 

Thank you a bunch!


Accepted Solutions
Solution
‎04-13-2016 11:14 PM
Esteemed Advisor
Posts: 6,646

Re: Leap year

data test;
do year = 1760 to 2400;
if mod(year,4) = 0 and (mod(year,100) ne 0 or mod(year,400) = 0) then output;
run;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Respected Advisor
Posts: 3,062

Re: Leap year

I see you have already seen the post that contains this:

data leaptest;
  do year=1996 to 2016;
    date = mdy(02,29,year);
    if date ne . then output;
  end;
run;
Contributor
Posts: 21

Re: Leap year

Thank you. 

Grand Advisor
Posts: 17,327

Re: Leap year

Are you doing a test or studying for something?

Solution
‎04-13-2016 11:14 PM
Esteemed Advisor
Posts: 6,646

Re: Leap year

data test;
do year = 1760 to 2400;
if mod(year,4) = 0 and (mod(year,100) ne 0 or mod(year,400) = 0) then output;
run;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 21

Re: Leap year

Thank you!
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 398 views
  • 1 like
  • 4 in conversation