The CPM Procedure

Example 4.7 Controlling the Project Calendar

This example illustrates the use of the INTERVAL=,  DAYSTART=, and DAYLENGTH= options to control the project calendar. In Example 4.1 through Example 4.5, none of these three options is specified; hence the durations are assumed to be days (INTERVAL=DAY), and work is scheduled on all seven days of the week. In Example 4.6, the specification of INTERVAL=WEEKDAY causes the schedule to skip weekends. The present example shows further ways of controlling the project calendar. For example, you may want to control the work pattern during a standard week or the start and length of the workday.

Suppose you want to schedule the project specified in Example 4.1 but you want to schedule only on weekdays from 9 a.m. to 5 p.m. To schedule the project, use the INTERVAL=WORKDAY option rather than the default INTERVAL=DAY. Then, one unit of duration is interpreted as eight hours of work. To schedule the manufacturing project to start on December 1, with an eight-hour workday and a five-day work week, you can invoke PROC CPM with the following statements. Output 4.7.1 displays the resulting schedule; the start and finish times are expressed in SAS datetime values.

title 'Controlling the Project Calendar';
title2 'Scheduling on Workdays';
proc cpm data=widget date='1dec03'd interval=workday;
   activity task;
   succ     succ1 succ2 succ3;
   duration days;
   run;

title3 'Day Starts at 9 a.m.';
proc print;
   id task;
   var e_: l_: t_float f_float;
   run;

Output 4.7.1: Controlling the Project Calendar: INTERVAL=WORKDAY

Controlling the Project Calendar
Scheduling on Workdays
Day Starts at 9 a.m.

task E_START E_FINISH L_START L_FINISH T_FLOAT F_FLOAT
Approve Plan 01DEC03:09:00:00 05DEC03:16:59:59 01DEC03:09:00:00 05DEC03:16:59:59 0 0
Drawings 08DEC03:09:00:00 19DEC03:16:59:59 08DEC03:09:00:00 19DEC03:16:59:59 0 0
Study Market 08DEC03:09:00:00 12DEC03:16:59:59 19JAN04:09:00:00 23JAN04:16:59:59 30 0
Write Specs 08DEC03:09:00:00 12DEC03:16:59:59 15DEC03:09:00:00 19DEC03:16:59:59 5 5
Prototype 22DEC03:09:00:00 09JAN04:16:59:59 22DEC03:09:00:00 09JAN04:16:59:59 0 0
Mkt. Strat. 15DEC03:09:00:00 26DEC03:16:59:59 26JAN04:09:00:00 06FEB04:16:59:59 30 30
Materials 12JAN04:09:00:00 23JAN04:16:59:59 12JAN04:09:00:00 23JAN04:16:59:59 0 0
Facility 12JAN04:09:00:00 23JAN04:16:59:59 12JAN04:09:00:00 23JAN04:16:59:59 0 0
Init. Prod. 26JAN04:09:00:00 06FEB04:16:59:59 26JAN04:09:00:00 06FEB04:16:59:59 0 0
Evaluate 09FEB04:09:00:00 20FEB04:16:59:59 16FEB04:09:00:00 27FEB04:16:59:59 5 5
Test Market 09FEB04:09:00:00 27FEB04:16:59:59 09FEB04:09:00:00 27FEB04:16:59:59 0 0
Changes 01MAR04:09:00:00 05MAR04:16:59:59 01MAR04:09:00:00 05MAR04:16:59:59 0 0
Production 08MAR04:09:00:00 08MAR04:09:00:00 08MAR04:09:00:00 08MAR04:09:00:00 0 0
Marketing 09FEB04:09:00:00 09FEB04:09:00:00 08MAR04:09:00:00 08MAR04:09:00:00 20 20


If you want to change the length of the workday, use the DAYLENGTH= option in the PROC CPM statement. For example, if you want an eight-and-a-half hour workday instead of the default eight-hour workday, you should include DAYLENGTH='08:30'T in the PROC CPM statement. In addition, you might also want to change the start of the workday. The workday starts at 9 a.m., by default. To change the default, use the DAYSTART= option. The following program schedules the project to start at 7 a.m. on December 1. The project is scheduled on eight-and-a-half hour workdays each starting at 7 a.m. Output 4.7.2 displays the resulting schedule produced by PROC CPM.

proc cpm data=widget date='1dec03'd interval=workday
         daylength='08:30't daystart='07:00't;
   activity task;
   succ     succ1 succ2 succ3;
   duration days;
   run;

title3 'Day Starts at 7 a.m. and is 8.5 Hours Long';
proc print;
   id task;
   var e_: l_: t_float f_float;
   run;

Output 4.7.2: Controlling the Project Calendar: DAYSTART and DAYLENGTH

Controlling the Project Calendar
Scheduling on Workdays
Day Starts at 7 a.m. and is 8.5 Hours Long

task E_START E_FINISH L_START L_FINISH T_FLOAT F_FLOAT
Approve Plan 01DEC03:07:00:00 05DEC03:15:29:59 01DEC03:07:00:00 05DEC03:15:29:59 0 0
Drawings 08DEC03:07:00:00 19DEC03:15:29:59 08DEC03:07:00:00 19DEC03:15:29:59 0 0
Study Market 08DEC03:07:00:00 12DEC03:15:29:59 19JAN04:07:00:00 23JAN04:15:29:59 30 0
Write Specs 08DEC03:07:00:00 12DEC03:15:29:59 15DEC03:07:00:00 19DEC03:15:29:59 5 5
Prototype 22DEC03:07:00:00 09JAN04:15:29:59 22DEC03:07:00:00 09JAN04:15:29:59 0 0
Mkt. Strat. 15DEC03:07:00:00 26DEC03:15:29:59 26JAN04:07:00:00 06FEB04:15:29:59 30 30
Materials 12JAN04:07:00:00 23JAN04:15:29:59 12JAN04:07:00:00 23JAN04:15:29:59 0 0
Facility 12JAN04:07:00:00 23JAN04:15:29:59 12JAN04:07:00:00 23JAN04:15:29:59 0 0
Init. Prod. 26JAN04:07:00:00 06FEB04:15:29:59 26JAN04:07:00:00 06FEB04:15:29:59 0 0
Evaluate 09FEB04:07:00:00 20FEB04:15:29:59 16FEB04:07:00:00 27FEB04:15:29:59 5 5
Test Market 09FEB04:07:00:00 27FEB04:15:29:59 09FEB04:07:00:00 27FEB04:15:29:59 0 0
Changes 01MAR04:07:00:00 05MAR04:15:29:59 01MAR04:07:00:00 05MAR04:15:29:59 0 0
Production 08MAR04:07:00:00 08MAR04:07:00:00 08MAR04:07:00:00 08MAR04:07:00:00 0 0
Marketing 09FEB04:07:00:00 09FEB04:07:00:00 08MAR04:07:00:00 08MAR04:07:00:00 20 20


An alternate way of specifying the start of each working day is to set the INTERVAL= option to DTWRKDAY and specify a SAS datetime value for the project start date. Using INTERVAL=DTWRKDAY tells CPM that the DATE= option is a SAS datetime value and that the time given is the start of the workday. For the present example, you could have used DATE='1dec03:07:00'dt in conjunction with the specification INTERVAL=DTWRKDAY and DAYLENGTH='08:30't.