Resources

Banking Days Example

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: intex03.sas
 Description: Example program from SAS/ETS User's Guide,
              Date Intervals, Formats, and Functions
       Title: Banking Days Example
     Product: SAS/ETS Software
        Keys: time intervals, time functions
        PROC: interval functions
       Notes:

--------------------------------------------------------------*/

options intervalds=(BankingDays=BankDayDS);
data BankDayDS(keep=BEGIN);
   start = '15DEC1998'D;
   stop  = '15JAN2002'D;
   nwkdays = INTCK('WEEKDAY',start,stop);
   do i = 0 to nwkdays;
      BEGIN = INTNX('WEEKDAY',start,i);
      year = YEAR(BEGIN);
      if BEGIN ne HOLIDAY("NEWYEAR",year) and
         BEGIN ne HOLIDAY("MLK",year) and
         BEGIN ne HOLIDAY("USPRESIDENTS",year) and
         BEGIN ne HOLIDAY("MEMORIAL",year) and
         BEGIN ne HOLIDAY("USINDEPENDENCE",year) and
         BEGIN ne HOLIDAY("LABOR",year) and
         BEGIN ne HOLIDAY("COLUMBUS",year) and
         BEGIN ne HOLIDAY("VETERANS",year) and
         BEGIN ne HOLIDAY("THANKSGIVING",year) and
         BEGIN ne HOLIDAY("CHRISTMAS",year) then
      output;
   end;
   format BEGIN DATE.;
run;


data CountDays;
   start = '01JAN1999'D;
   stop  = '31DEC2001'D;
   ActualDays = INTCK('DAYS',start,stop);
   Weekdays   = INTCK('WEEKDAYS',start,stop);
   BankDays   = INTCK('BankingDays',start,stop);
   format start stop DATE.;
run;


title 'Methods of Counting Days';
proc print data=CountDays;
run;