Comparing Progress against a BASELINE (gantte11)

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: GANTTE11                                            */
/*   TITLE: Comparing Progress against a BASELINE (gantte11)    */
/* PRODUCT: OR                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: GANTT                                               */
/*   PROCS: CPM, SORT, GANTT                                    */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT:                             UPDATE:                 */
/*     REF: Example 11 in the GANTT Chapter (PM User's Guide)   */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/

title h=1.2 'Gantt Example 11';

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

* print the data;
title2 'Progress Data';

proc print;
   var task e_: l_: a_start a_finish b_: ;
   run;


pattern1 c=green v=s;     /* duration of a non-critical activity   */
pattern2 c=green v=e;     /* slack time for a noncrit. activity    */
pattern3 c=red   v=s;     /* duration of a critical activity       */
pattern4 c=magenta v=e;   /* slack time for a supercrit. activity  */
pattern5 c=magenta v=s;   /* duration of a supercrit. activity     */
pattern6 c=cyan v=s;      /* actual duration of an activity        */
pattern7 c=black v=e;     /* break due to a holiday                */
pattern8 c=blue v=s;      /* resource schedule of activity         */
pattern9 c=brown v=s;     /* baseline schedule of activity         */

title2 'Comparing Project Progress against a Baseline Schedule';

* plot the actual and baseline schedules using proc gantt;
proc gantt data=widgupdt holidata=holidays;
   chart / holiday=(holiday) holifin=(holifin)
           timenow='19dec03'd dur=days
           scale=2 height=1.6
           pcompress;
   id task;
   run;