BookmarkSubscribeRSS Feed
Marcate
Calcite | Level 5

I would like to calculate the working days interval between two columns of a working table.

The idea is to create a table that will use informations from two other tables as follow: one with the list of the holidays of the year and another that contains the dates that must be compared. How do I have to proceed? 

2 REPLIES 2
Shmuel
Garnet | Level 18

I did it in two steps:

 

1) using table of non working dates - create a format (NWD.) with

     each non working date translated to 0 and OTHER translated to 1.
    Do it once, for the whole period of years including some future years.

 

2) calculate working days (WDS) from given dates: from FDT to UDT by:

         WDS = 0;

         do date = FTD to UDT;

              WDS = WDS + input(put(date,NWD.),1.);

         end;

Patrick
Opal | Level 21

SAS offers quite a few very useful calendar functions like intnx() and intck() which allows you get such calculations done.

 

If you have your own holiday calendar then you must first create a "custom interval" though. Have a look into the Custom Intervals section under the following link: http://www.sascommunity.org/wiki/Generating_Holiday_Lists 

 

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!

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
  • 2 replies
  • 885 views
  • 1 like
  • 3 in conversation