Activity-on-Node Representation (cpme01)

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: CPME01                                              */
 /*   TITLE: Activity-on-Node Representation (cpme01)            */
 /* PRODUCT: OR                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: NETDRAW                                             */
 /*   PROCS: CPM, NETDRAW                                        */
 /*    DATA:                                                     */
 /*                                                              */
 /* SUPPORT:                             UPDATE:                 */
 /*     REF: Example 1 from the CPM Chapter. Includes program to */
 /*          draw the Network diagram. (PM User's Guide)         */
 /*    MISC:                                                     */
 /*                                                              */
 /****************************************************************/


/* Activity-on-Node representation of the project */
   data widget;
   format task $12. succ1-succ3 $12.;
   input task & days succ1 & succ2 & succ3 & ;
   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  .             .             .
;

/* Invoke PROC CPM to schedule the project specifying the */
/* ACTIVITY, DURATION and SUCCESSOR variables             */
proc cpm;
   activity task;
   duration days;
   successor succ1 succ2 succ3;
   run;

title 'Widget Manufacture: Activity-On-Node Format';
title2 'Critical Path';
proc print;
   run;


data details;
   format task $12. dept $13. descrpt $30. ;
   input task & dept $ descrpt & ;
   label dept =  "Department"
         descrpt = "Activity Description";
   datalines;
Approve Plan  Planning       Finalize and Approve Plan
Drawings      Engineering    Prepare Drawings
Study Market  Marketing      Analyze Potential Markets
Write Specs   Engineering    Write Specifications
Prototype     Engineering    Build Prototype
Mkt. Strat.   Marketing      Develop Marketing Concept
Materials     Manufacturing  Procure Raw Materials
Facility      Manufacturing  Prepare Manufacturing Facility
Init. Prod.   Manufacturing  Initial Production Run
Evaluate      Testing        Evaluate Product In-House
Test Market   Testing        Mail Product to Sample Market
Changes       Engineering    Engineering Changes
Production    Manufacturing  Begin Full Scale Production
Marketing     Marketing      Begin Full Scale Marketing
   ;

/* Combine project network data with additional details */
data widgetn;
   merge widget details;
   run;


/* Schedule using PROC CPM, identifying the variables */
/* that specify additional project information        */
/* and set project start date to be December 1, 2003  */
proc cpm data=widgetn date='1dec03'd;
   activity task;
   successor succ1 succ2 succ3;
   duration days;
   id dept descrpt;
   run;


proc sort;
   by e_start;
   run;

title2 'Project Schedule';
proc print;
   id descrpt;
   var dept e_: l_: t_float f_float;
   run;


pattern1 v=e c=green;
pattern2 v=e c=red;
pattern3 v=e c=magenta;
pattern4 v=e c=blue;
pattern5 v=e c=cyan;

title  j=l ' Project: Widget Manufacture';
title2 j=l ' Date: December 1, 2003';
footnote j=r 'Zoned Network Diagram ';
proc netdraw data=widgetn graphics;
   actnet / act=task succ=(succ1 succ2 succ3)
            zone=dept
            zonepat
            carcs = blue
            lref = 33
            separatearcs
            compress height=2;
   run;