Select Your Region
Americas
Europe
Middle East & Africa
Asia Pacific
/****************************************************************/ /* S A S S A M P L E L I B R A R Y */ /* */ /* NAME: PMEX05 */ /* TITLE: Subdivision Construction Project */ /* PRODUCT: OR */ /* SYSTEM: ALL */ /* KEYS: CPM */ /* PROCS: CPM, PRINT, NETDRAW, GANTT, SORT, GCHART, GPLOT */ /* DATA: */ /* */ /* SUPPORT: UPDATE: */ /* REF: Example 5 of Project Management Examples Book */ /* MISC: Project Management: Methods and Studies, B.V. Dean, */ /* ed., Lee and Olson, pp. 126-134 */ /****************************************************************/ 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 'Subdivision Construction Project'; data build; input act $ s1 $ s2 $ s3 $ s4 $ dur id & $20. cranes carpntrs laborers; cards; A B . . . 4 Excavate & Footers 1 2 2 B C E S . 2 Pour Foundation 1 2 4 C D H J Q 4 Frame & Roof 1 4 . D W . . . 6 Brickwork 1 . 2 E F G . . 1 Basement Plumbing . . . F J . . . 2 Pour Basement 1 . 4 G K . . . 3 Rough Plumbing . . 2 H L . . . 2 Initial Wiring . . . J K . . . 4 Heat & Ventilation 1 . . K L . . . 10 Plaster . . . L M N P . 3 Finish Flooring . 4 . M V . . . 1 Kitchen Fixtures . . . N . . . . 2 Finish Plumbing . . . P U . . . 3 Finish Carpentry . 4 . Q R . . . 2 Finish Roof 1 3 . R W . . . 1 Gutters & Downspouts 1 . . S X . . . 1 Storm Drains 1 2 2 T . . . . 2 Varnish Floor . . 3 U T . . . 3 Paint . . . V . . . . 1 Finish Electrical . . . W X . . . 2 Finish Grading . . 2 X . . . . 5 Walks & Landscape 1 2 2 ; pattern1 v=e; title2 'Building a House'; proc netdraw graphics data=build; actnet/activity=act successor=(s1-s4) id=(id dur) nodefid nolabel compress separatearcs font=simplex; run; pattern1 v=s; data breslvl; input period cranes carpntrs laborers; cards; 0 1 5 4 ; proc cpm data=build out=bout resin=breslvl resout=bres; activity act; duration dur; id id; successor s1-s4; resource cranes carpntrs laborers/period=period noe_start nol_start avp rcp delayanalysis; run; proc sort data=bout; by s_start; run; title2 'Initial Schedule'; proc gantt graphics data=bout; chart/compress nolegend;id id; run; symbol1 i=steplj w=2 l=1; pattern1 v=M3N135; axis1 label=('Number of Workers'); title2 'Laborer Requirements'; proc gplot data=bres; plot rlaborers * _time_ /vaxis=axis1 areas=1; run; quit; axis2 order=(0,1) minor=none label=('Number of Cranes'); title2 'Crane Usage'; proc gplot data=bres; plot rcranes * _time_/vaxis=axis2 areas=1; run; quit; data delay (keep=res r_delay); set bout; res=delay_r; if delay_r=' ' then res='NONE'; label res='Delaying Resource'; run; title2 h=1.5 'Distribution of Delaying Resources'; title3 h=1.2 'Percentage of Activities Delayed'; goptions htext=1; proc gchart data=delay; pie res / type=freq percent=outside value=outside slice=outside explode='NONE' noheading; run; quit; goptions htext=1.5; title2 'Total (and Average) Workdays of Delay'; proc gchart data=delay; vbar res / midpoints= 'cranes' 'carpntrs' 'laborers' mean width=15 type=sum sumvar=r_delay; run; quit; pattern1 v=s; /* Adding a Second House */ title2 'Building Two Houses'; data build1; set build; act='H1'||act; if s1 ne '' then s1='H1'||s1; if s2 ne '' then s2='H1'||s2; if s3 ne '' then s3='H1'||s3; if s4 ne '' then s4='H1'||s4; house=1; run; data build1a; set build; act='H2'||act; if s1 ne '' then s1='H2'||s1; if s2 ne '' then s2='H2'||s2; if s3 ne '' then s3='H2'||s3; if s4 ne '' then s4='H2'||s4; house=2; run; data build2; set build1 build1a; run; proc print data=build2 noobs;run; proc cpm data=build2 out=bout2 resin=breslvl resout=bres2; activity act; duration dur; id id house; successor s1-s4; resource cranes carpntrs laborers/period=period noe_start nol_start avp rcp delayanalysis; run; proc sort data=bout2; by house s_start; run; title2 'Combined Schedule'; proc gantt graphics data=bout2; chart/compress nolegend hconnect lhcon=2;id id house; run; data delay1 (keep=res r_delay house); set bout2; res=delay_r; if delay_r=' ' then res='NONE'; label res='Delaying Resource'; run; title2 h=1.5 'Distribution of Delaying Resources'; goptions htext=1; proc gchart data=delay1; pie res / type=freq percent=outside value=outside slice=outside explode='NONE' group=house across=2 noheading; run; quit; title2 h=1.5 'Total (and Average) Workdays of Delay'; proc gchart data=delay1; vbar res / midpoints= 'cranes' 'carpntrs' 'laborers' group=house mean width=12 type=sum sumvar=r_delay; run; quit; goptions htext=1.5; proc cpm data=build2 out=bout3 resin=breslvl resout=bres3; activity act; duration dur; id id house; successor s1-s4; resource cranes carpntrs laborers/period=period noe_start nol_start avp rcp rule=actprty actprty=house; run; proc sort data=bout3; by s_start; run; title2 'Prioritizing House 1'; proc print data=bout3 noobs; var id house cranes carpntrs laborers s_start s_finish; run; proc cpm data=build1 out=house1 resin=breslvl resout=resout1; activity act; duration dur; id id house; successor s1-s4; resource cranes carpntrs laborers/period=period noe_start nol_start avp rcp; run; title2 'House 1 Resource Usage Data'; proc print data=resout1 noobs;run; data remres; set resout1 (rename=(acranes=cranes acarpntrs=carpntrs alaborers=laborers _time_=period)); keep period cranes carpntrs laborers; run; proc cpm data=build1a out=house2 resin=remres resout=resout2; activity act; duration dur; id id house; successor s1-s4; resource cranes carpntrs laborers/period=period noe_start nol_start avp rcp; run; data houses; set house1 house2; run; proc sort data=houses; by s_start; run; title2 'Sequential Scheduling of Houses'; proc gantt graphics data=houses; chart/compress nolegend hconnect lhcon=2; id id house; run; data resout; merge resout1 resout2; by _time_; run; title2 'Crane Usage - Sequential Scheduling'; symbol1 i=steplj w=2 l=1; pattern1 v=M3N135; proc gplot data=resout; plot rcranes * _time_/vaxis=axis2 areas=1; run; quit; pattern1 v=s; data resprty; input obstype $ period cranes carpntrs laborers; cards; resprty . 1 2 2 ; data resin; set breslvl resprty; if period=0 then obstype='reslevel'; run; proc cpm data=build2 out=bout4 resin=resin resout=bres4; activity act; duration dur; id id house; successor s1-s4; resource cranes carpntrs laborers/period=period noe_start nol_start avp rcp obstype=obstype rule=resprty; run; proc sort data=bout4; by s_start; run; title2 'Crane Priority Schedule'; proc print data=bout4 noobs; var id house cranes carpntrs laborers s_start s_finish; run; title2 'Crane Priority Resource Usage'; proc print data=bres4 noobs; run; title2 'Crane Schedule'; proc gantt graphics data=bout4; chart/compress nolegend; id id house; where cranes ^= .; run;