Is there a way to generate a list of holidays (dates) referenced by the sas Holiday function.
Are these dates stored in a sashelp view?
Couldn't you just roll your own by copying that list, excluding the dates you don't want, and including the years you want? E.g.,
data holidays;
informat holiday $20.;
infile cards truncover;
input holiday;
cards;
BOXING Boxing Day December 26
CANADA Canadian Independence Day July 1
CANADAOBSERVED Canadian Independence Day observed July 1, or July 2 if July 1 is a Sunday
CHRISTMAS Christmas December 25
COLUMBUS Columbus Day 2nd Monday in October
EASTER Easter Sunday date varies
FATHERS Father's Day 3rd Sunday in June
HALLOWEEN Halloween October 31
LABOR Labor Day 1st Monday in September
MLK Martin Luther King, Jr. 's birthday 3rd Monday in January beginning in 1986
MEMORIAL Memorial Day last Monday in May (since 1971)
MOTHERS Mother's Day 2nd Sunday in May
NEWYEAR New Year's Day January 1
THANKSGIVING U.S. Thanksgiving Day 4th Thursday in November
THANKSGIVINGCANADA Canadian Thanksgiving Day 2nd Monday in October
USINDEPENDENCE U.S. Independence Day July 4
USPRESIDENTS Abraham Lincoln's and George Washington's birthdays observed 3rd Monday in February (since 1971)
VALENTINES Valentine's Day February 14
VETERANS Veterans Day November 11
VETERANSUSG Veterans Day - U.S. government-observed U.S. government-observed date for Monday-Friday schedule
VETERANSUSPS Veterans Day - U.S. post office observed U.S. government-observed date for Monday-Saturday schedule (U.S. Post Office)
VICTORIA Victoria Day Monday on or preceding May 24
;
data want;
set holidays;
do year=2005 to 2011;
holiday_date=holiday(holiday,year);
output;
end;
run;
You could just print the list at:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003060817.htm
Let me be a bit more specific about what I need.
I have a set of dates going back 6 years. I need to corss-reference my set of dates with the SAS holiday database so I can exclude past holidays from my dataset.
Couldn't you just roll your own by copying that list, excluding the dates you don't want, and including the years you want? E.g.,
data holidays;
informat holiday $20.;
infile cards truncover;
input holiday;
cards;
BOXING Boxing Day December 26
CANADA Canadian Independence Day July 1
CANADAOBSERVED Canadian Independence Day observed July 1, or July 2 if July 1 is a Sunday
CHRISTMAS Christmas December 25
COLUMBUS Columbus Day 2nd Monday in October
EASTER Easter Sunday date varies
FATHERS Father's Day 3rd Sunday in June
HALLOWEEN Halloween October 31
LABOR Labor Day 1st Monday in September
MLK Martin Luther King, Jr. 's birthday 3rd Monday in January beginning in 1986
MEMORIAL Memorial Day last Monday in May (since 1971)
MOTHERS Mother's Day 2nd Sunday in May
NEWYEAR New Year's Day January 1
THANKSGIVING U.S. Thanksgiving Day 4th Thursday in November
THANKSGIVINGCANADA Canadian Thanksgiving Day 2nd Monday in October
USINDEPENDENCE U.S. Independence Day July 4
USPRESIDENTS Abraham Lincoln's and George Washington's birthdays observed 3rd Monday in February (since 1971)
VALENTINES Valentine's Day February 14
VETERANS Veterans Day November 11
VETERANSUSG Veterans Day - U.S. government-observed U.S. government-observed date for Monday-Friday schedule
VETERANSUSPS Veterans Day - U.S. post office observed U.S. government-observed date for Monday-Saturday schedule (U.S. Post Office)
VICTORIA Victoria Day Monday on or preceding May 24
;
data want;
set holidays;
do year=2005 to 2011;
holiday_date=holiday(holiday,year);
output;
end;
run;
That's a good idea.
I guess I just assumed there was some view or table that had these.
There might be but, since (according to the documentation) one can't add holidays to it, I've never looked for one. On the other hand, at least this way you can exclude any days that you don't want considered.
It's somewhat unlikely that the holiday set which SAS uses will conform to the holiday set appropriate to your business. For techniques to generate custom holiday lists, see
http://www.sascommunity.org/wiki/Generating_Holiday_Lists
Unfortunately these cannot be utilized with the HOLIDAY function.
Jaime wrote:
Let me be a bit more specific about what I need.
I have a set of dates going back 6 years. I need to corss-reference my set of dates with the SAS holiday database so I can exclude past holidays from my dataset.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.