I am trying to find the diff between two dates excluding weekends using intck ('weekday',date 1, date2) however i need to know how to exclude the below holidays between
the dates
Value Amerhol
'24Dec2013'D,
'25Dec2013'D,
'31Dec2013'D,
'1Jan2014'D = 1
OTHER=0;
Hi , Try this. it excludes weekends and holidays.
data holiday;
input holiday date9.;
cards;
24Dec2013
25Dec2013
31Dec2013
01Jan2014
;
data real_date;
input real_date date9.;format real_date date9.;
cards;
20Dec2013
21Dec2013
22Dec2013
23Jan2013
24Dec2013
25Dec2013
26DEC2013
27DEC2013
28DEC2013
29DEC2013
30Dec2013
31DEC2013
01JAN2014
02JAN2014
05JAN2014
10JAN2014
12JAN2014
14JAN2014
15JAN2014
;
proc sql noprint;
select holiday into :holiday separated by ',' from holiday;
quit;
data test;
set real_date(where=(weekday(real_date) not in (1,7) and real_date not in (&holiday.)));
Diff=intck('day','14JAN2014'd,real_date);
run;
Thank you Pradeep. What i am needing is that the date range will be in fiscal week : for ex :- fiscal week 201440 ( nov'13 ) till fiscal week 201448 ( dec'13) my question is do i need to list each day?
i am having a calculated function intck ('weekday',date 1, date2) which is giving the working days between fiscal week 201440 ( 2nd nov'13 ) till fiscal week 201448 ( 3rdJan'14). for the same date range i need to calculate the working days without holidays below.
11Nov2013
22Nov2013
23Nov2013
24Dec2013
25Dec2013
1Jan2014
Here's a SAS function that can do the work.
Calculating the number of working days between two dates - The SAS Dummy
Chris
you need 2 different dates in some form, if you want to compare/find difference between them.
you can loop through the date range between your fiscal weeks( start date to your end date), then you don't have to list each day.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.