The CPM Procedure

Example 3.6 Changing Duration Units

(View the complete code for this example.)

This example illustrates the use of the INTERVAL= option to identify the units of duration to PROC CPM. In the previous examples, it was assumed that work can be done on the activities all seven days of the week without any break. Suppose now that you want to schedule the activities only on weekdays. To do so, specify INTERVAL=WEEKDAY in the PROC CPM statement. Output 3.6.1 displays the schedule produced by PROC CPM. Note that, with a shorter work week, the project finishes on March 9, 2026, instead of on February 9, 2026.


proc cpm data=widget out=save
     date='1dec25'd interval=weekday;
   activity task;
   succ     succ1 succ2 succ3;
   duration days;
   run;

title 'Changing Duration Units';
title2 'INTERVAL=WEEKDAY';
proc print;
   id task;
   var e_: l_: t_float f_float;
   run;

Output 3.6.1: Changing Duration Units: INTERVAL=WEEKDAY

Changing Duration Units
INTERVAL=WEEKDAY

taskE_STARTE_FINISHL_STARTL_FINISHT_FLOATF_FLOAT
Approve Plan01DEC2505DEC2501DEC2505DEC2500
Drawings08DEC2519DEC2508DEC2519DEC2500
Study Market08DEC2512DEC2519JAN2623JAN26300
Write Specs08DEC2512DEC2515DEC2519DEC2555
Prototype22DEC2509JAN2622DEC2509JAN2600
Mkt. Strat.15DEC2526DEC2526JAN2606FEB263030
Materials12JAN2623JAN2612JAN2623JAN2600
Facility12JAN2623JAN2612JAN2623JAN2600
Init. Prod.26JAN2606FEB2626JAN2606FEB2600
Evaluate09FEB2620FEB2616FEB2627FEB2655
Test Market09FEB2627FEB2609FEB2627FEB2600
Changes02MAR2606MAR2602MAR2606MAR2600
Production09MAR2609MAR2609MAR2609MAR2600
Marketing09FEB2609FEB2609MAR2609MAR262020


To display the weekday schedule on a calendar, use the WEEKDAY option in the PROC CALENDAR statement. The following code sorts the Schedule data set by the E_START variable and produces a calendar shown in Output 3.6.2, which displays the schedule of activities for the month of December.

proc sort;
   by e_start;
   run;

/* truncate schedule: print only for december */
data december;
   set save;
   e_finish = min('31dec25'd, e_finish);
   if e_start <= '31dec25'd;
   run;

title3 'Calendar of Schedule';
options nodate pageno=1 ps=50;
proc calendar data=december schedule weekdays;
   id e_start;
   finish e_finish;
   var task;
   run;

Output 3.6.2: Changing Duration Units: WEEKDAY Calendar for December

Changing Duration Units
INTERVAL=WEEKDAY
Calendar of Schedule

--------------------------------------------------------------------------------- 
|                                                                               | 
|                                December  2025                                 | 
|                                                                               | 
|-------------------------------------------------------------------------------| 
|    Monday     |    Tuesday    |   Wednesday   |   Thursday    |    Friday     | 
|---------------+---------------+---------------+---------------+---------------| 
|       1       |       2       |       3       |       4       |       5       | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|+================================Approve Plan=================================+| 
|---------------+---------------+---------------+---------------+---------------| 
|       8       |       9       |      10       |      11       |      12       | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|+=================================Write Specs=================================+| 
|+================================Study Market=================================+| 
|+==================================Drawings===================================>| 
|---------------+---------------+---------------+---------------+---------------| 
|      15       |      16       |      17       |      18       |      19       | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|+=================================Mkt. Strat.=================================>| 
|<==================================Drawings===================================+| 
|---------------+---------------+---------------+---------------+---------------| 
|      22       |      23       |      24       |      25       |      26       | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|+==================================Prototype==================================>| 
|<=================================Mkt. Strat.=================================+| 
|---------------+---------------+---------------+---------------+---------------| 
|      29       |      30       |      31       |               |               | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|               |               |               |               |               | 
|<==================Prototype==================+|               |               | 
--------------------------------------------------------------------------------- 


The durations of the activities in the project are multiples of 5. Thus, if work is done only on weekdays, all activities in the project last 0, 1, 2, or 3 weeks. The INTERVAL= option can also be used to set the units of duration to hours, minutes, seconds, years, months, quarters, or weeks. In this example, the data set WIDGWK is created from WIDGET to set the durations in weeks. PROC CPM is then invoked with INTERVAL=WEEK, and the resulting schedule is displayed in Output 3.6.3. Note that the float values are also expressed in units of weeks.

data widgwk;
   set widget;
   weeks = days / 5;
   run;

proc cpm data=widgwk date='1dec25'd interval=week;
   activity  task;
   successor succ1 succ2 succ3;
   duration  weeks;
   id task;
   run;

title2 'INTERVAL=WEEK';
proc print;
   id task;
   var e_: l_: t_float f_float;
   run;

Output 3.6.3: Changing Duration Units: INTERVAL=WEEK

Changing Duration Units
INTERVAL=WEEK

taskE_STARTE_FINISHL_STARTL_FINISHT_FLOATF_FLOAT
Approve Plan01DEC2507DEC2501DEC2507DEC2500
Drawings08DEC2521DEC2508DEC2521DEC2500
Study Market08DEC2514DEC2519JAN2625JAN2660
Write Specs08DEC2514DEC2515DEC2521DEC2511
Prototype22DEC2511JAN2622DEC2511JAN2600
Mkt. Strat.15DEC2528DEC2526JAN2608FEB2666
Materials12JAN2625JAN2612JAN2625JAN2600
Facility12JAN2625JAN2612JAN2625JAN2600
Init. Prod.26JAN2608FEB2626JAN2608FEB2600
Evaluate09FEB2622FEB2616FEB2601MAR2611
Test Market09FEB2601MAR2609FEB2601MAR2600
Changes02MAR2608MAR2602MAR2608MAR2600
Production09MAR2609MAR2609MAR2609MAR2600
Marketing09FEB2609FEB2609MAR2609MAR2644


Last updated: November 10, 2025