Resources

Construction Project (evme02)

/***************************************************************/
/*                                                             */
/*          S A S   S A M P L E   L I B R A R Y                */
/*                                                             */
/*    NAME: evme02                                             */
/*   TITLE: Construction Project (evme02)                      */
/* PRODUCT: OR                                                 */
/*  SYSTEM: ALL                                                */
/*    KEYS: OR                                                 */
/*   PROCS: CPM, SORT, Earned Value Macros                     */
/*    DATA:                                                    */
/*                                                             */
/* SUPPORT:                             UPDATE:                */
/*     REF:                                                    */
/*    MISC: Example 2 from the Earned Value Management Macros  */
/*          chapter of Project Management.                     */
/*                                                             */
/***************************************************************/

/* Schedule input */

data build;
   input activity $ s1 $ s2 $ s3 $ s4 $ dur
         cost spct & $32. rate project $7. id & $20.
         cranes carpntrs laborers;
   datalines;
a . . . . 1  0     0         0         Build House           . . .
b . . . . 1  0     0         0       a Landscaping           . . .
c . . . . 1  0     0         0       a Drainage              . . .
d . . . . 1  0     0         0       a Wiring                . . .
e . . . . 1  0     0         0       a Plumbing              . . .
f . . . . 1  0     0         0       a Foundation            . . .
g . . . . 1  0     0         0       a Roofing               . . .
h . . . . 1  0     0         0       a Flooring              . . .
A B . . . 4  5250  50        20      f Excavate & Footers    1 2 2
B C E S . 2  1500  25        15      f Pour Foundation       1 2 4
F J . . . 2  950   50        20      f Pour Basement         1 . 4
G K . . . 3  1025  25        30      e Rough Plumbing        . . 2
E F G . . 1  1000  25        50      e Basement Plumbing     . . .
N . . . . 2  350   25        20      e Finish Plumbing       . . .
J K . . . 4  325   50        40      a Heat & Ventilation    1 . .
K L . . . 10 14500 1,2,3,4   20      a Plaster               . . .
T . . . . 2  750   25        15      h Varnish Floor         . . 3
L M N P . 3  425   50        25      h Finish Flooring       . 4 .
H L . . . 2  575   25        45      d Initial Wiring        . . .
M V . . . 1  375   25        25      d Kitchen Fixtures      . . .
V . . . . 1  550   25        50      d Finish Electrical     . . .
P U . . . 3  1450  25        20      d Finish Carpentry      . 4 .
Q R . . . 2  725   50        40      g Finish Roof           1 3 .
C D H J Q 4  9500  25        35      g Frame & Roof          1 4 .
D W . . . 6  9500  1,2,3     45      a Brickwork             1 . 2
U T . . . 3  3250  50        30      a Paint                 . . .
R W . . . 1  1200  50        15      c Gutters & Downspouts  1 . .
S X . . . 1  150   25        15      c Storm Drains          1 2 2
W X . . . 2  425   25        25      b Finish Grading        . . 2
X . . . . 5  2475  25        25      b Walks & Landscape     1 2 2
;

proc sort data=build;
   by project;
run;

/* Resources */

data breslvl;
   input period cranes carpntrs laborers;
   datalines;
0 1 5 4
;

/* Produce initial schedule */

proc cpm data=build out=sbout
   resin=breslvl resout=bres
   date='04SEP10'd;
   activity activity;
   duration dur;
   id id;
   successor s1-s4;
   project project / addwbs;
   resource cranes carpntrs laborers/period=period
   noe_start nol_start avp rcp delayanalysis;
run;

/* Rename variables */

data gbsched;
   set sbout;
   keep id activity dur s_start s_finish wbs_code project
        proj_lev;
   rename dur=Duration;
   rename s_start=Start;
   rename s_finish=Finish;
   label wbs_code='WBS Code';
   label id='Activity';
run;

/* Sort schedule by WBS code */

proc sort data=gbsched;
   by wbs_code;
run;

title 'Planned Construction Schedule';
proc print data=gbsched label;
   var id wbs_code duration start finish;
run;

/* Show WBS chart */


%evg_wbs_chart(
   structure=gbsched,
   activity=activity,
   project=project,
   id=wbs_code id,
   rotate=N,
   rotatetext=N,
   defid=N
);

/* Initial costs */

data gbase;
   set build;
   keep id activity cost spct rate;
   rename spct=SPct;
   rename cost=Cost;
   label spct='Start Pct./Weights';
   label id='Activity';
   rename rate=Rate;
run;

title 'Planned Construction Costs';
proc print data=gbase label;
   var id cost spct rate;
run;

/* Daily planned value */

title;

%eva_planned_value(
   plansched=gbsched,
   activity=activity,
   start=start,
   finish=finish,
   budgetcost=gbase,
   rate=rate,
   cost=cost,
   spct=spct,
   taskpv=bout,
   pv=gbcost
);

title 'Daily Planned Value';
proc print data=gbcost label;
run;

/* Update schedule with actuals */

data actual;
   input activity $8. as : date7. af : date7. actcost actrate
         pctcomp;
   format as af date7.;
   datalines;
A       04SEP10 11SEP10  6350 30 100
B       12SEP10 14SEP10  2700 30 100
;

data order;
   set build;
   retain _seqno_ 0;
   _seqno_ = _seqno_ + 1;
run;

proc sort data=order;
   by activity;
run;

proc sort data=actual;
   by activity;
run;

data build2;
   merge actual order;
   by activity;
run;

proc sort data=build2;
   by _seqno_;
run;

proc cpm data=build2 out=sbout2 resin=breslvl resout=bres
         date='04SEP10'd;
   activity activity;
   duration dur;
   id id;
   successor s1-s4;
   project project / addwbs;
   resource cranes carpntrs laborers/period=period
   noe_start nol_start avp rcp delayanalysis;
   actual / a_start=as a_finish=af timenow='15SEP10'd
            pctcomp=pctcomp;
run;

/* Rename variables */

data gasched;
   set sbout2;
   keep activity id dur s_start s_finish proj_lev wbs_code;
   rename dur=a_dur;
   rename s_start=Start;
   rename s_finish=Finish;
   label id='Activity';
   label wbs_code='WBS Code';
   label dur='Duration';
run;

title 'Updated Construction Schedule';
proc print data=gasched label;
 var id wbs_code a_dur start finish;
run;

/* Updated costs */

data gact;
   set build2;
   keep id activity cost spct rate;
   if actrate ne . then do;
      rate=actrate;
   end;
   if actcost ne . then do;
      cost=actcost;
   end;
   label id='Activity';
   label rate='Rate';
   label cost='Cost';
   label spct='Start Pct./Weights';
run;

title 'Updated Construction Costs';
proc print data=gact label;
   var id rate cost spct;
run;

/* Daily planned value */

title;

%eva_earned_value(
   revisesched=gasched,
   activity=activity,
   start=start,
   finish=finish,
   actualcost=gact,
   rate=rate,
   cost=cost,
   spct=spct,
   taskpv=bout,
   ev=gacost
);

title 'Daily Earned Value and Revised Cost';
proc print data=gacost label;
run;

%eva_metrics(
   pv=gbcost,
   ev=gacost,
   timenow='04SEP10'd '15SEP10'd '01OCT10'd '17OCT10'd
);

/* Produce summary data for 15SEP10 for charts */

%eva_metrics(
   pv=gbcost,
   ev=gacost,
   timenow='15SEP10'd
);

%eva_task_metrics(
   activity=id,
   plansched=gbsched,
   revisesched=gasched,
   start=start,
   finish=finish,
   budgetcost=gbase,
   actualcost=gact,
   cost=cost,
   spct=spct,
   rate=rate,
   timenow='15SEP10'd,
   aggregate=Y
);

%evg_cost_plot;

%evg_schedule_plot;

%evg_index_plot;

%evg_variance_plot;

%evg_gantt_chart(
   activity=id,
   plansched=gbsched,
   revisesched=gasched,
   start=start,
   finish=finish,
   timenow='15SEP10'd,
   id=wbs cv sv,
   height=3,
   scale=40
);