Use of the SETFINISHMILESTONE Option (cpm28)
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: CPM28 */
/* TITLE: Use of the SETFINISHMILESTONE Option (cpm28) */
/* PRODUCT: OR */
/* SYSTEM: ALL */
/* KEYS: CPM */
/* PROCS: CPM, GANTT, PRINT */
/* DATA: */
/* */
/* SUPPORT: UPDATE: */
/* REF: */
/* MISC: Example 1 from V8.2 Changes and Enhancements */
/* Example 28 in CPM chapter of Project Management */
/* */
/****************************************************************/
data tasks;
format act $7. succ $7. lag $4. target date7.
trgttype $3. miledate date7. notrgtmd date7. ;
input act & succ & lag $ dur target & date7.
trgttype $ miledate & date7. notrgtmd & date7. ;
datalines;
Task 0 Mile 1 ss_0 1 26Jan04 SGE . .
Mile 1 Task 2 . 0 . . 26Jan04 26Jan04
Task 2 . . 1 . . . .
Task 3 Mile 4 . 1 . . . .
Mile 4 . . 0 . . 26Jan04 26Jan04
Task 5 Mile 6 . 1 . . . .
Mile 6 Mile 7 FS_1 0 . . 26Jan04 26Jan04
Mile 7 . . 0 . . 27Jan04 27Jan04
Task 8 Mile 9 SS_3 1 . . . .
Mile 9 Mile 10 . 0 . . 29Jan04 29Jan04
Mile 10 . . 0 . . 29Jan04 29Jan04
Task 11 Mile 12 . 2 . . . .
Mile 12 Mile 13 FS_1 0 28Jan04 SGE 28Jan04 27Jan04
Mile 13 . . 0 . . 29Jan04 28Jan04
;
title 'Schedule with option SETFINISHMILESTONE';
title2 'Input Data Set';
proc print;
run;
/* Schedule the project */
proc cpm data=tasks
out=out0
collapse
interval=day
date='26jan04'd;
activity act;
successor succ /lag=(lag);
duration dur;
id lag notrgtmd;
run;
title 'Schedule with option SETFINISHMILESTONE';
title2 'Default Schedule';
proc print heading=v;
run;
proc cpm data=tasks out=out1
collapse interval=day
date='26jan04'd
setfinishmilestone;
activity act;
successor succ /lag=(lag);
duration dur;
id lag notrgtmd;
run;
title 'Schedule with option SETFINISHMILESTONE';
title2 'No Target Dates';
proc print heading=v;
id act;
var succ lag dur notrgtmd e_start e_finish
l_start l_finish efinmile lfinmile;
run;
proc cpm data=tasks out=out2
collapse
interval=day
date='26jan04'd
setfinishmilestone;
activity act;
successor succ /lag=(lag);
duration dur;
aligndate target;
aligntype trgttype;
id target trgttype lag miledate;
run;
title 'Schedule with option SETFINISHMILESTONE';
title2 'Target Dates change Early Schedule for some Milestones';
proc print heading=v;
id act;
var succ lag target trgttype miledate e_start e_finish
l_start l_finish efinmile lfinmile;
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 */
title h=1.5 'Schedule with option SETFINISHMILESTONE and ALIGNDATE';
title2 'Gantt Chart of Early Schedule without adjustment';
proc gantt data=out2(drop=l_:);
chart / compress act=act succ=succ lag=lag
scale=7 height=1.7
cprec=cyan cmile=magenta
caxis=black
dur=dur nojobnum nolegend;
id act succ lag e_start efinmile;
run;
/* Save adjusted E_START and E_FINISH times for finish
milestones */
data temp;
set out2;
format estart efinish date7.;
estart = e_start;
efinish = e_finish;
if efinmile then do;
estart=estart+1;
efinish=efinish+1;
end;
run;
/* Plot the adjusted start and finish times for the
early schedule */
title h=1.5 'Schedule with option SETFINISHMILESTONE and ALIGNDATE';
title2 'Gantt Chart of Early Schedule after adjustment';
proc gantt data=temp(drop=l_:);
chart / compress act=act succ=succ lag=lag
scale=7 height=1.7
es=estart ef=efinish
cprec=cyan cmile=magenta
caxis=black
dur=dur nojobnum nolegend;
id act succ lag e_start efinmile;
run;