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! :)
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:
10 Comments
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.
You might start with some of my 'tutorial' blogs... http://blogs.sas.com/content/sastraining/tag/robs_tutorials/
Thank you sir!
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.
Thanks Prashant! I too would love for SAS/Graph to be added to the SUE! I'm working on that request from within SAS, but it might also help if you also make the request on the "SAS Communities" forum: https://communities.sas.com/community/sas-analytics-u/sas-analytics-u-for-professors
Yes Robert. I did actually fill out a Survey regarding the SUE Software and i did mention the request to add SAS/GRAPH in a future release of SUE. Though most of the basic Graphs probably can be produced by SG Procedures which is bundled with BASE SAS , for Maps SAS/GRAPH is still needed as you very well know.
Excellent - thanks!
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.)
Nice visualization Rob! I hope you don't require any strategies to deal with paraskevidekatriaphobia today... http://www.wikihow.com/Deal-With-Paraskevidekatriaphobia
Hahaha! - So now I know the name for it! :)