HOLIDAYTEST Function
Returns 1 if the holiday occurs on the SAS date value.
| Category: | Date and Time |
|---|
Table of Contents
Syntax
Required Arguments
'holiday'
is a character constant, variable, or expression that specifies one of the values that are listed in the following table. The holiday variable can also be defined using the DATEKEYS procedure and is made available to the function that uses the EVENTDS= system option.
|
Holiday Value |
Description |
Date Celebrated |
|---|---|---|
|
BOXING |
Boxing Day |
December 26 |
|
CANADA |
Canada Day |
July 1 |
|
CANADAOBSERVED |
Canada Day observed |
July 1, or July 2 if July 1 is a Sunday |
|
CHRISTMAS |
Christmas |
December 25 |
|
COLUMBUS |
Columbus Day |
2nd Monday in October |
|
JUNETEENTH |
Juneteenth |
June 19 |
|
JUNETEENTHUSG |
Juneteenth - U.S. government-observed |
Juneteenth date observed by U.S. government for Monday–Friday schedule |
|
JUNETEENTHUSPS |
Juneteenth - U.S. post office -observed |
Juneteenth date observed by U.S. government for Monday–Saturday schedule (U.S. Postal Service) |
|
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 |
date
specifies the beginning date value in the form ‘ddmonyy’d or ‘ddmonyyyy’d.
| dd | is a two-digit integer that represents the day of the month. |
| mon | is a three-character string that represents the month: JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC. |
| yy or yyyy | is a two- or four-digit integer that represents the year. If only two digits are used, the YEARCUTOFF= option is valid. |
Optional Argument
'locale'
specifies the POSIX locale value. See Locale-to-Encoding Mapping in SAS National Language Support (NLS) Reference for SAS Viya Workbench.
Details
The EVENTDS= option makes the date keys available. You can define the date keys with the DATEKEYS procedure. Also, you can assign a locale to a date key with the DATEKEYS procedure. If you do not assign the locale to the date keys, then the predefined date keys do not have locales. If the locale argument is specified, then the date key must be defined using the DATEKEYS procedure, or a predefined date key needs to have a locale set that uses the DATEKEYS procedure. Then the new definition needs to be made available with the EVENTDS= system option.
Example
The following example specifies whether the holiday occurs on the SAS date:
data a;
length is $9;
holiday='Christmas';
test=holidaytest(holiday,today());
if (test=1) then is='today';
else is='not today';
put holiday= is=;
run;
SAS writes these results to the log:
holiday=Christmas is=not today