Using the COMBINE option (gantte12)

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: GANTTE12                                            */
/*   TITLE: Using the COMBINE option (gantte12)                 */
/* PRODUCT: OR                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: GANTT                                               */
/*   PROCS: CPM, SORT, GANTT                                    */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT:                             UPDATE:                 */
/*     REF: Example 12 in the GANTT Chapter (PM User's Guide)   */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/

title h=1.6 'Gantt Example 12';

 /* 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  .             .             .
;


data holidays;
   format holiday holifin date7.;
   input holiday & date7. holifin & date7. holidur;
   datalines;
24dec03  26dec03  4
01jan04  .        .
;

* store early schedule as the baseline schedule;
proc cpm data=widget holidata=holidays
         out=widgbase date='1dec03'd;
   activity task;
   succ     succ1 succ2 succ3;
   duration days;
   holiday  holiday / holifin=(holifin);
   baseline / set=early;
   run;

* actual schedule at timenow = 19dec03;
data actual;
   format task $12. sdate date7. fdate date7.;
   input task & sdate & date7. fdate & date7. pctc rdur;
   datalines;
Approve Plan   01dec03  05dec03  .    .
Drawings       06dec03  16dec03  .    .
Study Market   05dec03  .        100  .
Write Specs    07dec03  12dec03  .    .
Prototype      .        .        .    .
Mkt. Strat.    10dec03  .        .    3
Materials      .        .        .    .
Facility       .        .        .    .
Init. Prod.    .        .        .    .
Evaluate       .        .        .    .
Test Market    .        .        .    .
Changes        .        .        .    .
Production     .        .        .    .
Marketing      .        .        .    .
;

* merge the baseline information with progress update;
data widgact;
   merge  actual widgbase;
   run;

* estimate schedule based on actual data;
proc cpm data=widgact holidata=holidays
         out=widgupdt date='1dec03'd;
   activity task;
   succ     succ1 succ2 succ3;
   duration days;
   holiday  holiday / holifin=(holifin);
   baseline / compare=early;
   actual / as=sdate af=fdate timenow='19dec03'd
            remdur=rdur pctcomp=pctc
            autoupdt;
   run;

* sort the data;
proc sort;
   by e_start;
   run;

* set up required pattern statements;
goptions reset=pattern;

pattern1 c=green v=s;  /* duration of a noncrit. activity  */
pattern2 c=green v=e;  /* slack time for a noncrit. act.   */
pattern3 c=red   v=s;  /* duration of a critical activity  */
pattern4 c=red   v=e;  /* slack time for a supercrit. act. */
pattern5 c=red   v=r2; /* duration of a supercrit. act.    */
pattern6 c=cyan  v=s;  /* actual duration of an activity   */
pattern7 c=black v=x1; /* break due to a holiday           */
pattern8 c=cyan  v=x2; /* res. constrained dur of an act.  */
pattern9 c=blue  v=s;  /* baseline duration of an activity */

title2 'Using the COMBINE Option';

* set vpos to 50 and hpos to 100;
goptions vpos=50 hpos=100;

* plot the combined and baseline schedules using proc gantt;
proc gantt graphics data=widgupdt holidata=holidays;
   chart / holiday=(holiday) holifin=(holifin)
           compress ctnow=red caxis=black
           height=1.5
           timenow='19dec03'd
           dur=days
           combine;
   id task;
   run;