BookmarkSubscribeRSS Feed
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

Does SAS have a fix for the holiday function that will recognize June 19, 2022 as a US holiday?

so that I can fix my work around???

USJUNETEENTH = holiday('USINDEPENDENCE',year)+15;

to work like this....

to work like this USJUNETEENTH = holiday('USJUNETEENTH',year);

 

7 REPLIES 7
AMSAS
SAS Super FREQ
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

when I call the holiday function for Juneteenth I get an error and the date is not resolved.  What do I need to do to fixed it so that Juneteenth would work?

 

WARNING: In a call to the HOLIDAY function or routine, the date keyword JUNETEENTH was not defined using the EVENTDS
system option.
NOTE: Argument 1 to function HOLIDAY('JUNETEENTH',2023) at line 2130 column 22 is invalid.
WARNING: In a call to the HOLIDAY function or routine, the date keyword JUNETEENTH was not defined using the EVENTDS
system option.
NOTE: Argument 1 to function HOLIDAY('JUNETEENTH',2024) at line 2130 column 22 is invalid.
WARNING: In a call to the HOLIDAY function or routine, the date keyword JUNETEENTH was not defined using the EVENTDS
system option.
NOTE: Argument 1 to function HOLIDAY('JUNETEENTH',2025) at line 2130 column 22 is invalid.
holiday_dt=. Holiday=JUNETEENTH DAY rptmo=20250. year=2026 USINDEPENDENCE=23926 WEEKDAY=. month=. JUNETEENTH=. _ERROR_=1
_N_=1

 

 

code used to create a dataset


data list_of_new_holidays;*(keep=year month holiday_dt holiday rptmo);
length holiday_dt 8. Holiday $24 rptmo $6;
do year = 2021 to 2025;

USINDEPENDENCE = holiday('USINDEPENDENCE',year);
holiday_dt =USINDEPENDENCE;
WEEKDAY=WEEKDAY(USINDEPENDENCE);
if weekday = 1 then holiday_dt = Holiday_dt +1;
else if weekday = 7 then holiday_dt = holiday_dt -1;
Holiday = "INDEPENDENCE DAY";
month=month(holiday_dt);
rptmo = compress(year||0||month);
output;

if year > 2021 then do;

*USJUNETEENTH = holiday('USINDEPENDENCE',year)+15;
JUNETEENTH = holiday('JUNETEENTH',year);
holiday_dt =JUNETEENTH;
WEEKDAY=WEEKDAY(JUNETEENTH);
if weekday = 1 then holiday_dt = Holiday_dt +1;
else if weekday = 7 then holiday_dt = holiday_dt -1;
Holiday = "JUNETEENTH DAY";
month=month(holiday_dt);
rptmo = compress(year||0||month);
output;


end;

end;
format holiday_dt mmddyys10.;

run;
proc sort data=list_of_new_holidays;
by holiday_dt;
run;

Reeza
Super User

Probably a version issue, what version of SAS are you on?

 

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

SAS (r) Proprietary Software 9.4 (TS1M6)

Reeza
Super User
Same issue on M6 as well 😞
Patrick
Opal | Level 21

Same issue here for SAS9.4M7 for OS license for WX64_WKS and not as documented:
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lefunctionsref/p12v9lpx7rlthin1cnpd320l3mj... 

Suggest you raise a defect with SAS TechSupport

data test;
  infile datalines truncover;
  input holiday_value $40.;
  result_dt=holiday(holiday_value,2022);
  format result_dt date9.;
datalines;
BOXING
CANADA
CANADAOBSERVED
CHRISTMAS
COLUMBUS
EASTER
FATHERS
HALLOWEEN
Juneteenth
LABOR
MLK
MEMORIAL
MOTHERS
NEWYEAR
THANKSGIVING
THANKSGIVINGCANADA
USINDEPENDENCE
USPRESIDENTS
VALENTINES
VETERANS
VETERANSUSG
VETERANSUSPS
VICTORIA
;
proc print data=test;
run;

Patrick_0-1652946248369.png

 

ballardw
Super User

Look up Proc Datekeys which has a few examples of creating and referencing a valid dataset to add to the system Eventds option. You will not want to use the Nodefaults as you are adding to the existing events. Then you will need to add an Options statement to use the data set created.

 

You likely will need to define the Friday before/ Monday after as the actual holiday when June 19 is on a Saturday/Sunday to get the actual holiday date similar to 4th of July.

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2220 views
  • 0 likes
  • 5 in conversation