Pipeline Maintenance Project
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: PMEX07 */
/* TITLE: Pipeline Maintenance Project */
/* PRODUCT: OR */
/* SYSTEM: ALL */
/* KEYS: CPM */
/* PROCS: CPM, PRINT, GANTT, SORT, GPLOT */
/* DATA: */
/* */
/* SUPPORT: UPDATE: */
/* REF: Example 7 of Project Management Examples Book */
/* MISC: Moder, Phillips, and Davis, pp. 254-55 */
/* */
/****************************************************************/
goptions border hpos=80 vpos=43
fby=swiss
ftitle=swiss
htitle=2
ftext=swiss
htext=1.5;
pattern1 v=solid c=blue;
pattern2 v=e c=blue;
pattern3 v=solid c=red;
pattern4 v=e c=red;
pattern5 v=x2 c=red;
pattern6 v=solid c=green;
pattern7 v=e c=magenta;
pattern8 v=solid c=magenta;
pattern9 v=x1 c=cyan;
title 'Pipeline Maintenance Project';
data mntdata;
format id $23.;
input act s1 s2 s3 id & hours cost;
costper=cost/hours;
cards;
101 103 . . Inspect & Measure Pipe 4 16
102 105 106 . Develop Cal Mtls List 6 18
103 107 . . Make Drawings of Pipe 3 12
104 108 117 . Deactivate Line 8 8
105 108 . . Procure Calender Parts 244 12
106 108 . . Assemble Cal Work Crew 8 20
107 109 110 111 Develop Pipe Mtls List 4 10
108 112 . . Deactivate Calender 4 3
109 121 . . Procure Valves 220 10
110 113 . . Procure Pipe 200 10
111 113 114 . Assemble Pipe Work Crew 6 16
112 115 116 . Tie Off Warps 2 3
113 119 . . Prefab Pipe Sections 40 120
114 117 . . Erect Scaffold 12 30
115 118 . . Disassemble Calender 10 90
116 128 . . Empty & Scour Vats 3 6
117 119 . . Remove Old Pipe 30 180
118 120 . . Repair Calender 70 650
119 121 122 . Position New Pipe 8 50
120 123 . . Lubricate Calender 5 10
121 125 126 127 Position New Valves 7 66
122 125 126 127 Weld New Pipe 8 50
123 124 127 . Reassemble Calender 22 200
124 128 . . Adjust & Balance Cal 8 80
125 129 . . Insulate Pipes 20 60
126 129 130 . Connect Pipes to Boiler 4 24
127 132 . . Connect Pipes to Cal 8 48
128 131 . . Refill Vats 1 2
129 133 . . Remove Scaffold 4 16
130 133 . . Pressure Test 6 15
131 132 . . Tie in Warps 4 8
132 133 . . Activate Calender 2 14
133 . . . Clean Up 4 15
;
data mntres;
format date date7.;
input type $ date date7. costper;
cards;
restype . 2
reslevel 03sep91 2000
;
proc cpm data=mntdata out=mntout
interval=dthour date='03sep91:12:00'dt
resin=mntres resout=mcostusg;
activity act;duration hours;
successor s1 s2 s3;id id cost;
resource costper/obstype=type period=date
cumusage;
run;
proc sort data=mntout;
by e_start;
run;
title2 'Initial Schedule';
proc gantt graphics data=mntout
(firstobs=16 obs=31);
chart/compress nojobnum increment=2;
id id cost;
run;
legend1 label=('Schedule Followed')
value=('Early Start' 'Late Start')
across=2;
axis1 label=('Cumulative Cost');
axis2 label=none;
symbol1 i=join w=2 l=1;
symbol2 i=join w=2 l=2;
title2 'Cumulative Cost Profile Comparison';
proc gplot data=mcostusg;
format _time_ datetime7.;
plot (ecostper lcostper) * _time_ /overlay
vaxis=axis1 haxis=axis2 legend=legend1;
run;
quit;
data mntres1;
format date date7.;
input type $ date date7. costper;
cards;
restype . 2
reslevel 03sep91 500
reslevel 10sep91 1000
reslevel 17sep91 1500
reslevel 24sep91 2000
;
proc cpm data=mntdata out=mntout1
interval=dthour date='03sep91:12:00'dt
resin=mntres1 resout=mcost1;
activity act;duration hours;
successor s1 s2 s3;id id cost;
resource costper/obstype=type period=date
cumusage;
run;
data mntres2;
format date date7.;
input type $ date date7. costper;
cards;
restype . 2
reslevel 03sep91 1000
reslevel 17sep91 2000
;
proc cpm data=mntdata out=mntout2
interval=dthour date='03sep91:12:00'dt
resin=mntres2 resout=mcost2;
activity act;duration hours;
successor s1 s2 s3;id id cost;
resource costper/obstype=type period=date
cumusage;
run;
data initcost (keep=_time_ cost1);
set mcostusg;
cost1=acostper;
run;
data costa (keep=_time_ cost2);
set mcost1;
cost2=acostper;
run;
data costb (keep=_time_ cost3);
set mcost2;
cost3=acostper;
run;
data cost;
merge initcost costa costb;
by _time_;
run;
symbol1 i=join w=2 l=1;
symbol2 i=join w=2 l=2;
symbol3 i=join w=2 l=3;
legend2 label=('Funding Schedule Followed')
value=('Lump Sum' 'Incremental A' 'Incremental B');
axis3 label=('Available Funds');
title2 'Comparing Funding Schedules';
proc gplot data=cost;
format _time_ datetime7.;
plot (cost1 cost2 cost3) * _time_ / overlay
legend=legend2 vaxis=axis3 haxis=axis2;
run;
proc sort data=mntout2 (drop=e_: l_:);
by descending s_start;
run;
%let mscale=' ';
data _null_;
set mcost2 end=_e_;
if _e_ then scale=32/rcostper;
call symput('mscale',scale);
run;
data mcost2; set mcost2 end=lastobs;
if lastobs then _time_='21sep91:12:00'dt;
run;
%annomac;
data anno;
%dclanno;
%system(2,2,4);
set mcost2;
length lab $16;
length text $6;
x1=_time_;
y1=33-rcostper*symget('mscale');
lab=' ';
do date='03sep91:12:00'dt to '21sep91:12:00'dt by '48:00't;
if _time_=date then lab=put(rcostper,dollar6.);
end;
if _n_=1 then do;
%system(3,3,4);
%label(10,5,'COST',*,0,0,1.5,swiss,5);
%system(2,2,4);
%move(x1,y1);
end;
else do;
%draw(x1,y1,*,1,3);
end;
if lab ne ' ' then do;
%system(2,3,4);
%label(x1,5,lab,*,0,0,1.5,swiss,5);
%system(2,2,4);
end;
run;
footnote h=3 ' ';
title2 'Project Schedule and Expenditures';
proc gantt graphics data=mntout2;
chart/compress nojobnum annotate=anno
hconnect nolegend scale=7
ref='03sep91:12:00'dt to '21sep91:12:00'dt by '24:00't;
id id;
run;
footnote;
/* PERT Calculations */
data mntpert;set mntdata;
input lowhrs hihrs;
var=((hihrs-lowhrs)/3.2)**2;
meanhrs=(lowhrs + 4*hours + hihrs)/6;
cards;
2 5
3 8
2 5
7 10
120 320
6 9
3 7
4 5
136 280
136 240
4 7
1 3
20 50
6 15
4 14
2 5
18 38
35 98
6 12
3 6
5 10
6 11
18 24
6 14
15 30
3 5
7 11
1 1
3 4
5 9
3 5
2 3
3 5
;
proc cpm data=mntpert out=mpertout
interval=dthour date='03sep91:12:00'dt;
activity act;duration meanhrs;
successor s1 s2 s3;id id cost var;
run;
proc sort data=mpertout;
by e_start;
run;
title2 'Schedule with Mean Duration Times';
proc gantt graphics data=mpertout(firstobs=16 obs=31);
chart/compress nojobnum increment=2;id id cost;
run;
data mtotal (keep=mean stddev);
format mean datetime13. stddev time5.;
set mpertout end=lastobs;
if t_float=0 then do;
mean=e_finish;
totvar + var;
stddev=3600*totvar**.5;
end;
if lastobs;
run;
title2 'PERT Statistics';
proc print data=mtotal noobs;run;
data cumprob (drop=mean stddev);set mtotal;
format count datetime7.;
label count='Project Completion Time';
count='12sep91:00:00'dt;
do while (count < '26sep91:00:01'dt);
z=(count-mean)/stddev;
prob=probnorm(z);
output;
count=count+'01:00't;
end;
run;
title2 'Completion Time Probabilities';
proc print data=cumprob noobs;
var count prob z;
run;
symbol1 i=join w=4 l=1;
title2
'Cumulative Probability of Project Completion';
axis4 order=('12sep91:00:00'dt to '27sep91:00:00'dt
by '72:00't) minor=(number=2);
proc gplot data=cumprob;
plot prob * count/ haxis=axis4
href='19sep91:00:49'dt vref=.50;
run;