As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.
Here are some tips for How to share your SAS knowledge with your professional network.
Tips:Use the HOLIDAY Function to Compute the Date of a US or Canadian Holiday
data future_holidays; label year = "Year" mothersday= "Mothers Day" presidentsday = "Presidents Day" victoriaday = "Victoria Day" ; format mothersday presidentsday victoriaday worddate.; do year = 2009 to 2019 by 1; mothersday = holiday("MOTHERS",year); presidentsday=holiday("USPRESIDENTS",year); victoriaday=holiday("VICTORIA",year); output; end; run; proc print label; run;
The HOLIDAY function allows you to determine the date of major US and Canadian holidays. You simply supply the HOLIDAY function with the holiday keyword and the year, and it will return the SAS date value. The syntax looks like this:
- HOLIDAY('holiday', year)
See the simple example at right that computes three holidays for the next ten years:
There are currently twenty-two holiday keywords for the HOLIDAY function. You can read more about the HOLIDAY function in the
- The SAS 9.2 Language Reference: Dictionary
- in this excellent SAS Global Forum 2009 paper: Don't Be a SAS® Dinosaur: Modernizing Programs with Base SAS 9.2 Enhancements by Warren Repole, Jr., SAS Institute, Inc.
- in the article Generating Holiday Lists
Submitted by Michael A. Raithel, The man who wrote the book on performance. Contact me at my Discussion Page.