How many Friday the 13th will we have this year?

10

Yes, I use SAS for everything - even determining how many more Friday the 13th we have this year...

-----

I woke up this morning (June 13, 2014) and realized it was Friday the 13th. We haven't had one in a while (not since last year, actually), and I got to wondering how many more we will have this year. I guess I could have flipped through a calendar and checked month-by-month, but no respectable programmer would do it that way! :)

So I wrote a little bit of SAS code that prints out every Friday the 13th this year ...

data lucky13; 
 do day = '01jan2014'd to '31dec2014'd by 1;  
 if trim(left(put(day,downame.)))='Friday' and put(day,day.)=13 then output;  
 end; 
run; 

proc print data=lucky13; 
format day date9.; 
run;

And here are the results ... just one Friday the 13th in year 2014! :)

Friday the 13th in year 2014

But, in addition to being a programmer, I'm also a "Graph Guy" ... therefore I always try to find a graphical way to visualize my results. And what better way than a custom SAS/Graph calendar chart! Click the snapshot below to see the full-size calendar, with hover-text showing the exact dates:

Friday the 13th Calendar

Share

About Author

Robert Allison

The Graph Guy!

Robert has worked at SAS for over 25 years, and is perhaps the foremost expert in creating custom graphs using SAS/GRAPH. His educational background is in Computer Science, and he holds a BS, MS, and PhD from NC State University. He is the author of several conference papers, has won a few graphic competitions, and has written a book (SAS/GRAPH: Beyond the Basics).

10 Comments

  1. I think the 13th falls more on Fridays than any other days of the week. And if I recall correctly, there are at most 3 Friday 13th in the year. (I am subject to errors here but one can easily check the 14 different configurations of a calendar year.)

  2. Prashant Chegoor on

    Great Work Robert as always. Now with SAS University Edition (SUE) offered as a FREE software i request you to suggest to the SAS Unversity Edition Team to add the SAS/GRAPH product as one of the component of the SUE. Right now it is missing this Product but i guess a future enhancement made to SUE can add SAS/GRAPH too.

  3. Shunmugapriya on

    Nice one and easy to follow the coding. Basically I have interest for this SAS and I m following this SAS training post almost for the past 3 or 4 years I hope. I literally dont have any idea how to start with this SAS. The code you have posted seems to be very simple bringing more results. Can you suggest me how to get started with SAS and what to study.

Leave A Reply

Back to Top