Resources

Activity-on-Arc Representation of Project (cpme02)

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

/* Activity-on-Arc representation of the project */
data widgaoa;
   format task $12. ;
   input task & days tail head;
   datalines;
Approve Plan   5   1   2
Drawings      10   2   3
Study Market   5   2   4
Write Specs    5   2   3
Prototype     15   3   5
Mkt. Strat.   10   4   6
Materials     10   5   7
Facility      10   5   7
Init. Prod.   10   7   8
Evaluate      10   8   9
Test Market   15   6   9
Changes        5   9  10
Production     0  10  11
Marketing      0   6  12
Dummy          0   8   6
;

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
Dummy         .              Production Milestone
;

data widgeta;
   merge widgaoa details;
   run;


/* The project is scheduled using PROC CPM */
/* The network information is conveyed using the TAILNODE */
/* and HEADNODE statements. The ID statement is used to   */
/* transfer project information to the output data set    */
proc cpm data=widgeta date='1dec03'd out=save;
   tailnode tail;
   headnode head;
   duration days;
   activity task;
   id dept descrpt;
   run;

proc sort;
   by e_start;
   run;

title 'Widget Manufacture: Activity-On-Arc Format';
title2 'Project Schedule';
proc print;
   id descrpt;
   var dept e_: l_: t_float f_float;
   run;


 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: CPM Example 2 -- AOA representation                 */
 /*   TITLE: Modifying Arc Routing and ANNOTATE                  */
 /* PRODUCT: OR                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: NETDRAW                                             */
 /*   PROCS: FORMAT, NETDRAW                                     */
 /*    DATA:                                                     */
 /*                                                              */
 /* SUPPORT:                             UPDATE:                 */
 /*     REF: Network diagram in AOA format                       */
 /*    MISC:                                                     */
 /*                                                              */
 /****************************************************************/

data widgaoa;
   input task $ 1-12 days tail head _x_ _y_;
   datalines;
Approve Plan   5   1   2   1  2
Drawings      10   2   3   4  2
Study Market   5   2   4   4  2
Write Specs    5   2   3   4  2
Prototype     15   3   5   7  1
Mkt. Strat.   10   4   6  10  3
Materials     10   5   7  10  1
Facility      10   5   7  10  1
Init. Prod.   10   7   8  13  1
Evaluate      10   8   9  16  1
Test Market   15   6   9  18  2
Changes        5   9  10  20  1
Production     0  10  11  23  1
Marketing      0   6  12  19  2
Dummy          0   8   6  16  1
.              .  11   .  26  1
.              .  12   .  22  3
;

title j=l 'Project: Widget Manufacture';
title2 j=l h=1.5 'Network in Activity-on-Arc Format';
proc netdraw nodisplay data=widgaoa out=netout;
   actnet / act=tail succ=head id=(tail);

data netin;
  set netout;
  if _from_=4 and _to_=6 and _seq_>0 then _x_=16.5;
  run;

data anno1;
   set netout;
   if _seq_=0;
   /* Set up required variable lengths, etc. */
   length function color style   $8;
   length xsys ysys hsys         $1;
   length when position          $1;
   length text                   $12;
   xsys     = '2';
   ysys     = '2';
   hsys     = '4';
   when     = 'a';
   function = 'label   ';
   size = 2.5;
   position = '5';
   text = left(put(tail, f2.));
   x=_x_;
   if _y_ = 1 then y=_y_-.3;
   else            y=_y_+.5;
   run;

data anno2;
   /* Set up required variable lengths, etc. */
   length function color style   $8;
   length xsys ysys hsys         $1;
   length when position          $1;
   length text                   $12;
   xsys     = '2';
   ysys     = '2';
   hsys     = '4';
   when     = 'a';
   function = 'label   ';
   size = 2.5;
   position = '5';
   x=2.5;  y=1.8;  text='Approve Plan'; output;
   x=5.5;  y=.8;   text='Drawings';     output;
   x=5.7;  y=1.4;  text='Write Specs';  output;
   x=7;    y=3.4;  text='Study Market';  output;
   x=8.5;  y=.8;   text='Prototype';    output;
   x=11.5; y=1.4;  text='Facility';     output;
   x=11.5; y=.8;   text='Materials';    output;
   x=14.5; y=.9;   text='Init. Prod';   output;
   x=13.5; y=3.4;  text='Mkt. Strat.';  output;
   x=18;   y=.8;   text='Evaluate';     output;
   x=21.5; y=.8;   text='Changes';      output;
   x=24.5; y=.8;   text='Production';   output;
   x=20;   y=3.4;  text='Marketing';    output;
   position=6;
   x=16.6; y=1.5;  text='Dummy';        output;
   x=18.6; y=1.5;  text='Test Market';  output;
   ;

data anno;
   set anno1 anno2;
   run;

goptions hpos=120 vpos=80;
pattern1 v=s c=red;
title j=l h=3 'Project: Widget Manufacture';
title2 j=l h=2.2 'Network in Activity-on-Arc Format';

proc netdraw graphics data=netin anno=anno;
   actnet / nodefid
            nolabel
            boxwidth=1
            pcompress
            novcenter
            vmargin=20;
   run;