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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 4 replies
  • 4786 views
  • 6 likes
  • 3 in conversation