Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The CPM Procedure

Example 2.6: Changing Duration Units

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 2.6.1 displays the schedule produced by PROC CPM. Note that, with a shorter work week, the project finishes on March 9, 1992, instead of on March 1, 1992.

   proc cpm data=widget out=save
        date='2dec91'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 2.6.1: Changing Duration Units: INTERVAL=WEEKDAY

Changing Duration Units
INTERVAL=WEEKDAY

task E_START E_FINISH L_START L_FINISH T_FLOAT F_FLOAT
Approve Plan 02DEC91 06DEC91 02DEC91 06DEC91 0 0
Drawings 09DEC91 20DEC91 09DEC91 20DEC91 0 0
Anal. Market 09DEC91 13DEC91 20JAN92 24JAN92 30 0
Write Specs 09DEC91 13DEC91 16DEC91 20DEC91 5 5
Prototype 23DEC91 10JAN92 23DEC91 10JAN92 0 0
Mkt. Strat. 16DEC91 27DEC91 27JAN92 07FEB92 30 30
Materials 13JAN92 24JAN92 13JAN92 24JAN92 0 0
Facility 13JAN92 24JAN92 13JAN92 24JAN92 0 0
Init. Prod. 27JAN92 07FEB92 27JAN92 07FEB92 0 0
Evaluate 10FEB92 21FEB92 17FEB92 28FEB92 5 5
Test Market 10FEB92 28FEB92 10FEB92 28FEB92 0 0
Changes 02MAR92 06MAR92 02MAR92 06MAR92 0 0
Production 09MAR92 09MAR92 09MAR92 09MAR92 0 0
Marketing 10FEB92 10FEB92 09MAR92 09MAR92 20 20


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 2.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('31dec91'd, e_finish);
      if e_start <= '31dec91'd;
      run;

   title3 'Calendar of Schedule';
   proc calendar data=december schedule weekdays;
      id e_start;
      finish e_finish;
      var task;
      run;

Output 2.6.2: Changing Duration Units: WEEKDAY Calendar for December

Changing Duration Units
INTERVAL=WEEKDAY
Calendar of Schedule

  ----------------------------------------------------------------------------  
  |                                                                          |  
  |                              December  1991                              |  
  |                                                                          |  
  |--------------------------------------------------------------------------|  
  |    Monday    |   Tuesday    |  Wednesday   |   Thursday   |    Friday    |  
  |--------------+--------------+--------------+--------------+--------------|  
  |       2      |       3      |       4      |       5      |       6      |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |+==============================Approve Plan==============================+|  
  |--------------+--------------+--------------+--------------+--------------|  
  |       9      |      10      |      11      |      12      |      13      |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |+==============================Write Specs===============================+|  
  |+==============================Anal. Market==============================+|  
  |+================================Drawings================================>|  
  |--------------+--------------+--------------+--------------+--------------|  
  |      16      |      17      |      18      |      19      |      20      |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |+==============================Mkt. Strat.===============================>|  
  |<================================Drawings================================+|  
  |--------------+--------------+--------------+--------------+--------------|  
  |      23      |      24      |      25      |      26      |      27      |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |+===============================Prototype================================>|  
  |<==============================Mkt. Strat.===============================+|  
  |--------------+--------------+--------------+--------------+--------------|  
  |      30      |      31      |              |              |              |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |              |              |              |              |              |  
  |<=========Prototype=========+|              |              |              |  
  ----------------------------------------------------------------------------  


Note that 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 2.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='2dec91'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 2.6.3: Changing Duration Units: INTERVAL=WEEK

Changing Duration Units
INTERVAL=WEEK

task E_START E_FINISH L_START L_FINISH T_FLOAT F_FLOAT
Approve Plan 02DEC91 08DEC91 02DEC91 08DEC91 0 0
Drawings 09DEC91 22DEC91 09DEC91 22DEC91 0 0
Anal. Market 09DEC91 15DEC91 20JAN92 26JAN92 6 0
Write Specs 09DEC91 15DEC91 16DEC91 22DEC91 1 1
Prototype 23DEC91 12JAN92 23DEC91 12JAN92 0 0
Mkt. Strat. 16DEC91 29DEC91 27JAN92 09FEB92 6 6
Materials 13JAN92 26JAN92 13JAN92 26JAN92 0 0
Facility 13JAN92 26JAN92 13JAN92 26JAN92 0 0
Init. Prod. 27JAN92 09FEB92 27JAN92 09FEB92 0 0
Evaluate 10FEB92 23FEB92 17FEB92 01MAR92 1 1
Test Market 10FEB92 01MAR92 10FEB92 01MAR92 0 0
Changes 02MAR92 08MAR92 02MAR92 08MAR92 0 0
Production 09MAR92 09MAR92 09MAR92 09MAR92 0 0
Marketing 10FEB92 10FEB92 09MAR92 09MAR92 4 4

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.