Resources

Multiple Calendars (gantte09)

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: GANTTE09                                            */
/*   TITLE: Multiple Calendars (gantte09)                       */
/* PRODUCT: OR                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: GANTT                                               */
/*   PROCS: CPM, SORT, GANTT                                    */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT:                             UPDATE:                 */
/*     REF: Example 9 in the GANTT Chapter (PM User's Guide)    */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/

options ps=60 ls=80;

title  'Multiple Calendars';

 /* Activity-on-Node representation of the project */
data widget9;
   format task $12. succ1-succ3 $12.;
   input task & days succ1 & succ2 & succ3 & ;
   datalines;
Approve Plan  5.5  Drawings      Study Market  Write Specs
Drawings       10  Prototype     .             .
Study Market    5  Mkt. Strat.   .             .
Write Specs   4.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 widgvac;
   set widget9;
   if task = 'Production' then       cal = 'PROD_CAL';
   else if task = 'Prototype' then   cal = 'OVT_CAL';
   else if task = 'Write Specs' then cal = 'Eng_cal';
   else                              cal = 'DEFAULT';
   run;

data holidata;
   format holiday holifin date7.;
   input holiday & date7. holifin & date7. holidur cal $;
   datalines;
08dec03  .        7  Eng_cal
24dec03  26dec03  .  .
01jan04  01jan04  .  .
;

data workdata;
   input fullday time8. halfday time8. ovtday time8.
         s1 time8. s2 time8. s3 time8.;
   format fullday halfday ovtday s1 s2 s3 time6.;
   datalines;
08:00   08:00   08:00   .       08:00   .
16:00   12:00   18:00   06:00   18:00   06:00
.       .       .       08:00   20:00   08:00
.       .       .       18:00   .       18:00
.       .       .       20:00   .       .
.       .       .       .       .       .
;

data caledata;
   input  cal $ _sun_ $ _mon_$ _tue_$  _wed_$ _thu_$ _fri_$ _sat_ $;
   datalines;
DEFAULT  holiday fullday fullday fullday fullday fullday holiday
OVT_CAL  holiday ovtday  ovtday  ovtday  ovtday  ovtday  halfday
PROD_CAL holiday s2      s1      s1      s1      s1      s3
Eng_cal  .       .       .       .       .       .       .
;

proc print data=workdata;
   title3 'Workdays Data Set';
   run;

title1 " ";
title3;

proc print data=caledata;
   title2 'Calendar Data Set';
   run;

proc print data=holidata;
   title2 'Holidays Data Set';
   run;

proc print data=widgvac;
title2 'Project Data Set';
run;

* set up pattern statements;
pattern1 c=green v=s;
pattern2 c=green v=e;
pattern3 c=red v=s;
pattern4 c=magenta v=e;
pattern5 c=magenta v=s;
pattern6 c=cyan v=s;
pattern7 c=black v=e;

proc cpm date='01dec03'd interval=workday data=widgvac
         out=schedvac holidata=holidata
         workday=workdata calendar=caledata;
   holiday holiday / holifin=holifin holidur=holidur;
   activity task;
   duration days;
   successor succ1 succ2 succ3;
   calid cal;
   run;

title h=2 'Gantt Example 9';
title2 h=1.5 'Multiple Calendars';

proc gantt data=schedvac holidata=holidata
           workday=workdata calendar=caledata ;
   chart / holiday=(holiday) holiend=(holifin)
           calid=cal
           markbreak scale=12
           mindate='27dec03:00:00'dt
           maxdate='02jan04:08:00'dt
           pcompress;
   id task;
   run;