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);
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;
Probably a version issue, what version of SAS are you on?
SAS (r) Proprietary Software 9.4 (TS1M6)
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;
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.