Changing Duration Units (cpme06)

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: CPME06                                              */
 /*   TITLE: Changing Duration Units (cpme06)                    */
 /* PRODUCT: OR                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: CPM                                                 */
 /*   PROCS: CPM                                                 */
 /*    DATA:                                                     */
 /*                                                              */
 /* SUPPORT:                             UPDATE:                 */
 /*     REF: Example 6 from the CPM Chapter (PM User's Guide)    */
 /*    MISC:                                                     */
 /*                                                              */
 /****************************************************************/

 /* Activity-on-Node representation of the project */
data widget;
   input task $ 1-12 days succ1 $ 19-30 succ2 $ 33-44 succ3 $ 47-58;
   datalines;
Approve Plan   5  Drawings      Study Market  Write Specs
Drawings      10  Prototype
Study Market   5  Mkt. Strat.
Write Specs    5  Prototype
Prototype     15  Materials     Facility
Mkt. Strat.   10  Test Market   Marketing
Materials     10  Init. Prod.
Facility      10  Init. Prod.
Init. Prod.   10  Test Market   Marketing     Evaluate
Evaluate      10  Changes
Test Market   15  Changes
Changes        5  Production
Production     0
Marketing      0
;


proc cpm data=widget out=save
     date='1dec03'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;

proc sort;
   by e_start;
   run;

/* truncate schedule: print only for december */
data december;
   set save;
   e_finish = min('31dec03'd, e_finish);
   if e_start <= '31dec03'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;

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

proc cpm data=widgwk date='1dec03'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;