BookmarkSubscribeRSS Feed
sharath_rk
Calcite | Level 5


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;

4 REPLIES 4
pradeepalankar
Obsidian | Level 7

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;

sharath_rk
Calcite | Level 5

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

ChrisHemedinger
Community Manager

Here's a SAS function that can do the work.

Calculating the number of working days between two dates - The SAS Dummy

Chris

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
pradeepalankar
Obsidian | Level 7

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: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

SAS Enterprise Guide vs. SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 5393 views
  • 6 likes
  • 3 in conversation