Resources

Specifying CALEDATA and WORKDATA Data Sets (cpm9)

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: CPM9                                                */
 /*   TITLE: Specifying CALEDATA and WORKDATA Data Sets (cpm9)   */
 /* PRODUCT: OR                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: CPM                                                 */
 /*   PROCS: CPM                                                 */
 /*    DATA:                                                     */
 /*                                                              */
 /* SUPPORT:                             UPDATE:                 */
 /*     REF: Example 9 from the CPM Chapter (PM User's Guide)    */
 /*    MISC:                                                     */
 /*                                                              */
 /****************************************************************/

  TITLE 'Scheduling on the 6-Day Week';

 /* Activity-on-Node representation of the project */
data widget9;
   input task $ 1-12 days succ1 $ 19-30 succ2 $ 33-44 succ3 $ 47-58;
   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
;


TITLE 'Scheduling on the 6-Day Week';
title2 'Data Set WIDGET9';
proc print;
   run;

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

 /* Set up a 6-day work week, with Sundays off */
 data calendar;
    _sun_='holiday';
    run;

title 'Scheduling on the 6-Day Week';
proc cpm data=widget9 holidata=holidays
         out=savec date='1dec03:07:00'dt
         interval=dtday daylength='08:30't
         calendar=calendar;
   activity task;
   succ     succ1 succ2 succ3;
   duration days;
   holiday  holiday / holifin=(holifin);
   run;


TITLE 'Scheduling on the 6-Day Week';
title2 'Project Schedule';
proc print heading=h;
   var task days e_start e_finish l_start l_finish
       t_float f_float;
run;


TITLE 'Scheduling on a Five-and-a-Half-Day Week';

 /* Set up two work patterns: one from 8 a.m. to 4 p.m.
    and the other from 8 a.m. to 12 noon */
data workdat;
   input fullday time8. halfday time8.;
   format fullday halfday time6.;
   datalines;
08:00   08:00
16:00   12:00
;


TITLE 'Scheduling on a Five-and-a-Half-Day Week';
proc print;
   title2 'Workdays Data Set';
run;



 /* Define a work week with holiday on Sunday and half day on
    Saturday */
data caldat;
   input _sun_ $ _mon_ $ _tue_ $ _wed_ $
         _thu_ $ _fri_ $ _sat_ $ d_length time6.;
   format d_length time6.;
   datalines;
holiday   fullday  fullday  fullday  fullday  fullday  halfday  08:00
;


TITLE 'Scheduling on a Five-and-a-Half-Day Week';
proc print;
   title2 'Calendar Data Set';
run;

proc cpm data=widget9 holidata=holidays
         out=savecw date='1dec03'd
         interval=day
         workday=workdat calendar=caldat;
   activity task;
   succ     succ1 succ2 succ3;
   duration days;
   holiday  holiday / holifin=(holifin);
   run;



TITLE 'Scheduling on a Five-and-a-Half-Day Week';
title2 'Project Schedule';
proc print heading=h;
   var task days e_start e_finish l_start l_finish
       t_float f_float;
   run;

/* To visualize the breaks, use following "dummy" data set
   to plot a schedule bar showing holidays and breaks */
data temp;
   e_start='19dec03:08:00'dt;
   e_finish='27dec03:23:59:59'dt;
   task='Schedule Breaks';
   label task='Project Calendar';
   format e_start e_finish datetime16.;
   run;

title2 'Holidays and Breaks in the Project Calendar';
proc gantt data=temp lineprinter
           calendar=caldat holidata=holidays
           workday=workdat;
   chart / interval=dtday mininterval=dthour skip=0
           holiday=(holiday) holifin=(holifin) markbreak
           nojobnum nolegend increment=8 holichar='*';
   id task;
   run;