The CPM Procedure

Example 4.9 CALEDATA and WORKDATA Data Sets

This example shows how you can schedule the job over a nonstandard day and a nonstandard week. In the first part of the example, the calendar followed is a six-day week with an eight-and-a-half hour workday starting at 7 a.m. The project data are the same as were used in Example 4.8, but some of the durations have been changed to include some fractional values. Output 4.9.1 shows the project data set.

Output 4.9.1: Data Set WIDGET9: Scheduling on the Six-Day Week

Scheduling on the 6-Day Week
Data Set WIDGET9

Obs task days succ1 succ2 succ3
1 Approve Plan 5.5 Drawings Study Market Write Specs
2 Drawings 10.0 Prototype    
3 Study Market 5.0 Mkt. Strat.    
4 Write Specs 4.5 Prototype    
5 Prototype 15.0 Materials Facility  
6 Mkt. Strat. 10.0 Test Market Marketing  
7 Materials 10.0 Init. Prod.    
8 Facility 10.0 Init. Prod.    
9 Init. Prod. 10.0 Test Market Marketing Evaluate
10 Evaluate 10.0 Changes    
11 Test Market 15.0 Changes    
12 Changes 5.0 Production    
13 Production 0.0      
14 Marketing 0.0      



The same Holiday data set is used. To indicate that work is to be done on all days of the week except Sunday, use INTERVAL=DTDAY and define a Calendar data set with a single variable _SUN_, and a single observation identifying Sunday as a holiday. The DATA step creating CALENDAR and the invocation of PROC CPM is shown in the following code. Output 4.9.2 displays the resulting schedule.


 /* Set up a 6-day work week, with Sundays off */
 data calendar;
    _sun_='holiday';
    run;

title 'Scheduling on the 6-Day Week';
proc cpm data=widget9 holidata=holidays
         out=savec date='1dec03:07:00'dt
         interval=dtday daylength='08:30't
         calendar=calendar;
   activity task;
   succ     succ1 succ2 succ3;
   duration days;
   holiday  holiday / holifin=(holifin);
   run;

Output 4.9.2: Scheduling on the Six-Day Week

Scheduling on the 6-Day Week
Project Schedule

Obs task days E_START E_FINISH L_START L_FINISH T_FLOAT F_FLOAT
1 Approve Plan 5.5 01DEC03:07:00:00 06DEC03:11:14:59 01DEC03:07:00:00 06DEC03:11:14:59 0.0 0.0
2 Drawings 10.0 06DEC03:11:15:00 18DEC03:11:14:59 06DEC03:11:15:00 18DEC03:11:14:59 0.0 0.0
3 Study Market 5.0 06DEC03:11:15:00 12DEC03:11:14:59 15JAN04:11:15:00 21JAN04:11:14:59 30.0 0.0
4 Write Specs 4.5 06DEC03:11:15:00 11DEC03:15:29:59 13DEC03:07:00:00 18DEC03:11:14:59 5.5 5.5
5 Prototype 15.0 18DEC03:11:15:00 09JAN04:11:14:59 18DEC03:11:15:00 09JAN04:11:14:59 0.0 0.0
6 Mkt. Strat. 10.0 12DEC03:11:15:00 27DEC03:11:14:59 21JAN04:11:15:00 02FEB04:11:14:59 30.0 30.0
7 Materials 10.0 09JAN04:11:15:00 21JAN04:11:14:59 09JAN04:11:15:00 21JAN04:11:14:59 0.0 0.0
8 Facility 10.0 09JAN04:11:15:00 21JAN04:11:14:59 09JAN04:11:15:00 21JAN04:11:14:59 0.0 0.0
9 Init. Prod. 10.0 21JAN04:11:15:00 02FEB04:11:14:59 21JAN04:11:15:00 02FEB04:11:14:59 0.0 0.0
10 Evaluate 10.0 02FEB04:11:15:00 13FEB04:11:14:59 07FEB04:11:15:00 19FEB04:11:14:59 5.0 5.0
11 Test Market 15.0 02FEB04:11:15:00 19FEB04:11:14:59 02FEB04:11:15:00 19FEB04:11:14:59 0.0 0.0
12 Changes 5.0 19FEB04:11:15:00 25FEB04:11:14:59 19FEB04:11:15:00 25FEB04:11:14:59 0.0 0.0
13 Production 0.0 25FEB04:11:15:00 25FEB04:11:15:00 25FEB04:11:15:00 25FEB04:11:15:00 0.0 0.0
14 Marketing 0.0 02FEB04:11:15:00 02FEB04:11:15:00 25FEB04:11:15:00 25FEB04:11:15:00 20.0 20.0



Suppose now that you want to schedule work on a five-and-a-half day week (five full working days starting on Monday and half a working day on Saturday). A full work day is from 8 a.m. to 4 p.m. Output 4.9.3 shows the data set WORKDAT, which is used to define the work pattern for a full day (in the shift variable fullday and a half-day (in the shift variable halfday). Output 4.9.4 displays the Calendar data set, CALDAT, which specifies the appropriate work pattern for each day of the week. The schedule produced by invoking the following program is displayed in Output 4.9.5.

Output 4.9.3: Workday Data Set

Scheduling on a Five-and-a-Half-Day Week
Workdays Data Set

Obs fullday halfday
1 8:00 8:00
2 16:00 12:00



Output 4.9.4: Calendar Data Set

Scheduling on a Five-and-a-Half-Day Week
Calendar Data Set

Obs _sun_ _mon_ _tue_ _wed_ _thu_ _fri_ _sat_ d_length
1 holiday fullday fullday fullday fullday fullday halfday 8:00



proc cpm data=widget9 holidata=holidays
         out=savecw date='1dec03'd
         interval=day
         workday=workdat calendar=caldat;
   activity task;
   succ     succ1 succ2 succ3;
   duration days;
   holiday  holiday / holifin=(holifin);
   run;

Output 4.9.5: Scheduling on a Five-and-a-Half Day Week

Scheduling on a Five-and-a-Half-Day Week
Project Schedule

Obs task days E_START E_FINISH L_START L_FINISH T_FLOAT F_FLOAT
1 Approve Plan 5.5 01DEC03:08:00:00 06DEC03:11:59:59 01DEC03:08:00:00 06DEC03:11:59:59 0.0 0.0
2 Drawings 10.0 08DEC03:08:00:00 19DEC03:11:59:59 08DEC03:08:00:00 19DEC03:11:59:59 0.0 0.0
3 Study Market 5.0 08DEC03:08:00:00 12DEC03:15:59:59 20JAN04:08:00:00 26JAN04:11:59:59 30.0 0.0
4 Write Specs 4.5 08DEC03:08:00:00 12DEC03:11:59:59 15DEC03:08:00:00 19DEC03:11:59:59 5.5 5.5
5 Prototype 15.0 19DEC03:12:00:00 13JAN04:11:59:59 19DEC03:12:00:00 13JAN04:11:59:59 0.0 0.0
6 Mkt. Strat. 10.0 13DEC03:08:00:00 30DEC03:11:59:59 26JAN04:12:00:00 06FEB04:15:59:59 30.0 30.0
7 Materials 10.0 13JAN04:12:00:00 26JAN04:11:59:59 13JAN04:12:00:00 26JAN04:11:59:59 0.0 0.0
8 Facility 10.0 13JAN04:12:00:00 26JAN04:11:59:59 13JAN04:12:00:00 26JAN04:11:59:59 0.0 0.0
9 Init. Prod. 10.0 26JAN04:12:00:00 06FEB04:15:59:59 26JAN04:12:00:00 06FEB04:15:59:59 0.0 0.0
10 Evaluate 10.0 07FEB04:08:00:00 19FEB04:15:59:59 13FEB04:12:00:00 26FEB04:11:59:59 5.0 5.0
11 Test Market 15.0 07FEB04:08:00:00 26FEB04:11:59:59 07FEB04:08:00:00 26FEB04:11:59:59 0.0 0.0
12 Changes 5.0 26FEB04:12:00:00 03MAR04:15:59:59 26FEB04:12:00:00 03MAR04:15:59:59 0.0 0.0
13 Production 0.0 04MAR04:08:00:00 04MAR04:08:00:00 04MAR04:08:00:00 04MAR04:08:00:00 0.0 0.0
14 Marketing 0.0 07FEB04:08:00:00 07FEB04:08:00:00 04MAR04:08:00:00 04MAR04:08:00:00 20.0 20.0



Note that, in this case, it was not necessary to specify the DAYLENGTH=, DAYSTART=, or INTERVAL= option in the PROC CPM statement. The default value of INTERVAL=DAY is assumed, and the CALDAT and WORKDAT data sets define the workday and work week completely. The length of a standard working day is also included in the Calendar data set, completing all the necessary specifications.

To visualize the breaks in the work schedule created by these specifications, you can use the following simple data set with a dummy activity 'Schedule Breaks' to produce a Gantt chart, shown in Output 4.9.6. The period illustrated on the chart is from December 19, 2003 to December 27, 2003. The breaks are denoted by *.

/* To visualize the breaks, use following "dummy" data set
   to plot a schedule bar showing holidays and breaks */
data temp;
   e_start='19dec03:08:00'dt;
   e_finish='27dec03:23:59:59'dt;
   task='Schedule Breaks';
   label task='Project Calendar';
   format e_start e_finish datetime16.;
   run;

title2 'Holidays and Breaks in the Project Calendar';
proc gantt data=temp lineprinter
           calendar=caldat holidata=holidays
           workday=workdat;
   chart / interval=dtday mininterval=dthour skip=0
           holiday=(holiday) holifin=(holifin) markbreak
           nojobnum nolegend increment=8 holichar='*';
   id task;
   run;

Output 4.9.6: Gantt Chart Showing Breaks and Holidays

Scheduling on a Five-and-a-Half-Day Week
Holidays and Breaks in the Project Calendar

                             DEC     DEC     DEC     DEC     DEC     DEC             
          Project            19      19      20      20      20      21              
          Calendar           08:00   16:00   00:00   08:00   16:00   00:00           
                            -+-------+-------+-------+-------+-------+-              
          Schedule Breaks   |<-------****************----*************|              
                            -+-------+-------+-------+-------+-------+-              



Scheduling on a Five-and-a-Half-Day Week
Holidays and Breaks in the Project Calendar

            DEC     DEC     DEC     DEC     DEC     DEC     DEC     DEC              
            21      21      21      22      22      22      23      23               
            00:00   08:00   16:00   00:00   08:00   16:00   00:00   08:00            
           -+-------+-------+-------+-------+-------+-------+-------+-               
           |********************************--------****************-|               
           -+-------+-------+-------+-------+-------+-------+-------+-               



Scheduling on a Five-and-a-Half-Day Week
Holidays and Breaks in the Project Calendar

            DEC     DEC     DEC     DEC     DEC     DEC     DEC     DEC              
            23      23      24      24      24      25      25      25               
            08:00   16:00   00:00   08:00   16:00   00:00   08:00   16:00            
           -+-------+-------+-------+-------+-------+-------+-------+-               
           |--------*************************************************|               
           -+-------+-------+-------+-------+-------+-------+-------+-               



Scheduling on a Five-and-a-Half-Day Week
Holidays and Breaks in the Project Calendar

            DEC     DEC     DEC     DEC     DEC     DEC     DEC     DEC              
            25      26      26      26      27      27      27      28               
            16:00   00:00   08:00   16:00   00:00   08:00   16:00   00:00            
           -+-------+-------+-------+-------+-------+-------+-------+-               
           |****************************************----*************|               
           -+-------+-------+-------+-------+-------+-------+-------+-