The NETDRAW Procedure

Example 9.8 PATTERN and SHOWSTATUS Options

As a project progresses, in addition to the criticality of the activities, you may also want to display the status of the activity: whether it is in progress, has been completed, or is still to be scheduled. The SHOWSTATUS option in the ACTNET statement displays this additional information. In the current example, the same progress data as shown in Example 4.13 in Chapter 4: The CPM Procedure, are used to illustrate the SHOWSTATUS option. The following program shows the necessary code. First, PROC CPM schedules the project with the SHOWFLOAT option; this enables activities that are already in progress or completed also to show nonzero float. Following this, a DATA step sets the variable style to '3' for activities that are completed or in progress; the remaining activities have missing values for this variable.

PROC NETDRAW is then invoked with the SHOWSTATUS option, which draws two diagonal lines across nodes referring to completed activities and one diagonal line for in-progress activities. The PATTERN= option in the ACTNET statement identifies the variable style containing the pattern information. Thus, the third pattern statement is used for in-progress or completed activities; the other activities (which have missing values for the variable style) use the second or the first pattern statement according to whether or not they are critical. However, since the first two PATTERN statements have EMPTY fill patterns specified, the nodes representing activities that have not yet started are in fact colored on the basis of the COUTLINE= and CCRITOUT= options. The resulting network diagram is shown in Output 9.8.1.

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

* actual schedule at timenow = 19dec03;
data actual;
   format task $12. sdate fdate date7.;
   input task & sdate & date7. fdate & date7. pctc rdur;
Approve Plan  01dec03  05dec03  .    .
Drawings      06dec03  16dec03  .    .
Study Market  05dec03  .        100  .
Write Specs   07dec03  12dec03  .    .
Prototype     .        .        .    .
Mkt. Strat.   10dec03  .        .    3
Materials     .        .        .    .
Facility      .        .        .    .
Init. Prod.   .        .        .    .
Evaluate      .        .        .    .
Test Market   .        .        .    .
Changes       .        .        .    .
Production    .        .        .    .
Marketing     .        .        .    .

* merge the predicted information with network data;
data widgact;
   merge  actual widget;
* estimate schedule based on actual data;
proc cpm data=widgact holidata=holidays
         out=widgupd date='1dec03'd;
   activity task;
   succ     succ1 succ2 succ3;
   duration days;
   holiday  holiday / holifin=(holifin);
   actual / as=sdate af=fdate timenow='19dec03'd
            remdur=rdur pctcomp=pctc showfloat;
/* Set patterns for activities that have started */
data netin;
   set widgupd;
   if a_start ^= . then style = 3;
goptions hpos=120 vpos=70 border;
pattern1 c=green  v=e;
pattern2 c=red    v=e;
pattern3 c=ltgray v=s;

title  j=l h=3 ' Project: Widget Manufacture';
title2 j=l h=2 ' Date: December 19, 2003';
footnote1 j=l h=2 '  Activity';
footnote2 j=l h=2 '  Start';
footnote3 j=l h=2 '  Finish' 
          j=r h=2 'PATTERN and SHOWSTATUS Options  ';
proc netdraw data=netin graphics;
   actnet / act=task
            succ=(succ1 succ2 succ3)
            ybetween = 10
            id=(task e_start e_finish)
            nodefid nolabel
            coutline = green
            ccritout = red
            pattern = style

Output 9.8.1: PATTERN and SHOWSTATUS Options