HOLIDAYTEST Function

Returns 1 if the holiday occurs on the SAS date value.

Category:Date and Time
Restriction:This function is not valid on the CAS server.

Syntax

HOLIDAYTEST('holiday',date<,'locale'>)

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 Values and Their Descriptions
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
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.

ddis a two-digit integer that represents the day of the month.
monis a three-character string that represents the month: JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC.
yy or yyyyis 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= Values for PAPERSIZE and DFLANG Options in SAS Viya National Language Support: Reference Guide.

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;
holiday=Christmas is=not today
Last updated: March 16, 2017