The CPM Procedure

Example 2.8: Scheduling around Holidays

This example shows how you can schedule around holidays with PROC CPM. First, save a list of holidays in a SAS data set as SAS date variables. The length of the holidays is assumed to be measured in units specified by the INTERVAL= option. By default, all holidays are assumed to be one unit long. You can control the length of each holiday by specifying either the finish time for each holiday or the length of each holiday in the same observation as the holiday specification.

Output 2.8.1: Scheduling around Holidays: HOLIDAYS Data Set
Scheduling Around Holidays
Data Set HOLIDAYS

Obs holiday holifin holidur
1 24DEC03 26DEC03 4
2 01JAN04 . .



For example, the data set HOLIDAYS, displayed in Output 2.8.1 specifies two holidays, one for Christmas and the other for New Year's Day. The variable holiday specifies the start of each holiday. The variable holifin specifies the end of the Christmas holiday as 26Dec03. Alternately, the variable holidur can be used to interpret the Christmas holiday as lasting four interval units starting from the 24th of December. If the variable holidur is used, the actual days when work is not done depends on the INTERVAL= option and on the underlying calendar used. This form of specifying holidays or breaks is useful for indicating vacations for specific employees. The second observation in the data set defines the New Year's holiday as just one day long because both the variables holifin and holidur variables have missing values.

To invoke PROC CPM to schedule around holidays, use the HOLIDATA= option in the PROC CPM statement (see the following program) to identify the data set, and list the names of the variables in the data set in a HOLIDAY statement. The holiday start and finish are identified by specifying the HOLIDAY and HOLIFIN variables. Output 2.8.2 displays the schedule obtained.

  
    proc cpm data=widget holidata=holidays 
             out=saveh date='1dec03'd ; 
       activity task; 
       succ     succ1 succ2 succ3; 
       duration days; 
       holiday  holiday / holifin=(holifin); 
       run; 
  
    proc sort data=saveh; 
       by e_start; 
       run;
 
  
    title 'Scheduling Around Holidays'; 
    title2 'Project Schedule'; 
    goptions vpos=50 hpos=80 border; 
    goptions ftext=swiss; 
  
    proc gantt graphics data=saveh holidata=holidays; 
       chart / compress 
               font=swiss height=1.5 nojobnum skip=2 
               dur=days increment=7 
               holiday=(holiday) holifin=(holifin) 
               cframe=ligr; 
       id task; 
       run;
 

Output 2.8.2: Scheduling around Holidays: Project Schedule
cpm8o2.gif (4796 bytes)

The next two invocations illustrate the use of the HOLIDUR= option and the effect of the INTERVAL= option on the duration of the holidays. Recall that the holiday duration is also assumed to be in interval units where interval is the value specified for the INTERVAL= option. Suppose that a holiday period for the entire project starts on December 24, 2003, with duration specified as 4. First the project is scheduled with INTERVAL=DAY so that the holidays are on December 24, 25, 26, and 27, 2003. Output 2.8.3 displays the resulting schedule. The project completion is delayed by one day due to the extra holiday on December 27, 2003.

  
    proc cpm data=widget holidata=holidays 
             out=saveh1 date='1dec03'd 
             interval=day; 
       activity task; 
       succ     succ1 succ2 succ3; 
       duration days; 
       holiday  holiday / holidur=(holidur); 
       run; 
  
    title2 'Variable Length Holidays : INTERVAL=DAY'; 
    proc sort data=saveh1; 
       by e_start; 
       run; 
  
    proc gantt graphics data=saveh1 holidata=holidays; 
       chart / compress 
               font=swiss 
               height=1.5 skip=2 
               nojobnum 
               dur=days increment=7 
               holiday=(holiday) holidur=(holidur) interval=day 
               cframe=ligr; 
       id task; 
       run;
 

Output 2.8.3: Scheduling around Holidays: INTERVAL=DAY
cpm8o3.gif (5269 bytes)


Next, suppose that work on the project is to be scheduled only on weekdays. The INTERVAL= option is set to WEEKDAY. Then, the value '4' specified for the variable holidur is interpreted as 4 weekdays. Thus, the holidays are on December 24, 25, 26, and 29, 2003, because December 27 and 28 (Saturday and Sunday) are non-working days anyway. (Note that if holifin had been used, the holiday would have ended on December 26, 2003.) The following statements schedule the project to start on December 1, 2003 with INTERVAL=WEEKDAY. Output 2.8.4 displays the resulting schedule. Note the further delay in project completion time.

  
    proc cpm data=widget holidata=holidays 
             out=saveh2 date='1dec03'd 
             interval=weekday; 
       activity task; 
       succ     succ1 succ2 succ3; 
       duration days; 
       holiday  holiday / holidur=(holidur); 
       run; 
  
    proc sort data=saveh2; 
       by e_start; 
       run; 
  
    title2 'Variable Length Holidays : INTERVAL=WEEKDAY'; 
    proc gantt graphics data=saveh2 holidata=holidays; 
       chart / compress 
               font=swiss 
               height=1.5 skip=2 
               nojobnum 
               dur=days increment=7 
               holiday=(holiday) 
               holidur=(holidur) 
               interval=weekday 
               cframe=ligr; 
       id task; 
       run;
 

Output 2.8.4: Scheduling around Holidays: INTERVAL=WEEKDAY
cpm8o4.gif (5207 bytes)

Finally, the same project is scheduled to start on December 1, 2003 with INTERVAL=WORKDAY. Output 2.8.5 displays the resulting Schedule data set. This time the holiday period starts at 5:00 p.m. on December 23, 2003, and ends at 9:00 a.m. on December 30, 2003.

  
    proc cpm data=widget holidata=holidays 
             out=saveh3 date='1dec03'd 
             interval=workday; 
       activity task; 
       succ     succ1 succ2 succ3; 
       duration days; 
       holiday  holiday / holidur=(holidur); 
       run; 
  
    proc sort data=saveh3; 
       by e_start; 
       run;
 
  
    title2 'Variable Length Holidays : INTERVAL=WORKDAY'; 
    proc gantt graphics data=saveh3 holidata=holidays; 
       chart / compress 
               font=swiss height=1.5 nojobnum skip=2 
               dur=days increment=7 
               holiday=(holiday) holidur=(holidur) interval=workday 
               cframe=ligr; 
       id task; 
       run;
 

Output 2.8.5: Scheduling around Holidays: INTERVAL=WORKDAY
cpm8o5.gif (5472 bytes)

Previous Page | Next Page | Top of Page