The NETDRAW Procedure

Example 7.13: Modifying Network Layout

This example uses the SURVEY project described in Chapter 1, "Introduction to Project Management," to illustrate how you can modify the default layout of the network. The data set SURVEY contains the project information. PROC NETDRAW is invoked with the GRAPHICS option. The network diagram is shown in Output 7.13.1.

  
    data survey; 
       format id $20. activity succ1-succ3 $8. phase $9. ; 
       input id        & 
             activity  & 
             duration 
             succ1     & 
             succ2     & 
             succ3     & 
             phase     $ ; 
       datalines; 
    Plan Survey           plan sur   4 hire per  design q  .        Plan 
    Hire Personnel        hire per   5 trn per   .         .        Prepare 
    Design Questionnaire  design q   3 trn per   select h  print q  Plan 
    Train Personnel       trn per    3 cond sur  .         .        Prepare 
    Select Households     select h   3 cond sur  .         .        Prepare 
    Print Questionnaire   print q    4 cond sur  .         .        Prepare 
    Conduct Survey        cond sur  10 analyze   .         .        Implement 
    Analyze Results       analyze    6 .         .         .        Implement 
    ; 
  
    pattern1 v=s c=green; 
    title j=l ' Project: Market Survey'; 
    title2 j=l h=1.5 ' Changing Node Positions'; 
    footnote j=r 'Default Layout '; 
    proc netdraw data=survey graphics out=network; 
    actnet / act=activity 
             succ=(succ1-succ3) 
             id=(id) 
             nodefid 
             nolabel 
             carcs = blue 
             ctext  = white 
             coutline=red 
             centerid 
             boxht = 3 
             htext=2 
             pcompress 
             separatearcs 
             ybetween=8; 
    run; 
  
    title2 'NETWORK Output Data Set'; 
    proc print data=network; 
       run;
 

Output 7.13.1: Default Network Layout of SURVEY Project
ndr13g1.gif (11266 bytes)

The Layout data set produced by PROC NETDRAW (displayed in Output 7.13.2) contains the x and y coordinates for all the nodes in the network and for all the turning points of the arcs connecting them.

Suppose that you want to interchange the positions of the nodes corresponding to the two activities, 'Select Households' and 'Train Personnel.' As explained in the section "Controlling the Layout", you can invoke the procedure in FULLSCREEN mode and use the MOVE command to move the nodes to desired locations. In this example, the data set NETWORK produced by PROC NETDRAW is used to change the x and y coordinates of the nodes. A new data set called NODEPOS is created from NETWORK by retaining only the observations containing node positions (recall that for such observations, _SEQ_ = '0') and by dropping the _SEQ_ variable. Further, the y coordinates (given by the values of the _Y_ variable) for the two activities 'Select Households' and 'Train Personnel' are interchanged. The new data set, displayed in Output 7.13.3, is then input to PROC NETDRAW.

Output 7.13.2: Layout Data Set
Project: Market Survey
NETWORK Output Data Set

Obs _FROM_ _TO_ _X_ _Y_ _SEQ_ _PATTERN id
1 plan sur hire per 1.0 2 0 1 Plan Survey
2 plan sur hire per 1.5 2 1 . Plan Survey
3 plan sur hire per 1.5 3 2 . Plan Survey
4 plan sur design q 1.0 2 0 1 Plan Survey
5 hire per trn per 2.0 3 0 1 Hire Personnel
6 hire per trn per 2.5 3 1 . Hire Personnel
7 hire per trn per 2.5 1 2 . Hire Personnel
8 design q trn per 2.0 2 0 1 Design Questionnaire
9 design q trn per 2.5 2 1 . Design Questionnaire
10 design q trn per 2.5 1 2 . Design Questionnaire
11 design q select h 2.0 2 0 1 Design Questionnaire
12 design q select h 2.5 2 1 . Design Questionnaire
13 design q select h 2.5 3 2 . Design Questionnaire
14 design q print q 2.0 2 0 1 Design Questionnaire
15 trn per cond sur 3.0 1 0 1 Train Personnel
16 trn per cond sur 3.5 1 1 . Train Personnel
17 trn per cond sur 3.5 2 2 . Train Personnel
18 select h cond sur 3.0 3 0 1 Select Households
19 select h cond sur 3.5 3 1 . Select Households
20 select h cond sur 3.5 2 2 . Select Households
21 print q cond sur 3.0 2 0 1 Print Questionnaire
22 cond sur analyze 4.0 2 0 1 Conduct Survey
23 analyze   5.0 2 0 1 Analyze Results



  
    data nodepos; 
       set network; 
       if _seq_ = 0; 
       drop _seq_; 
       if _from_ = 'select h' then _y_=1; 
       if _from_ = 'trn per' then _y_=3; 
       run; 
  
    title2 'Modified Node Positions'; 
    proc print data=nodepos; 
       run;
 

Output 7.13.3: Modified Layout Data Set
Project: Market Survey
Modified Node Positions

Obs _FROM_ _TO_ _X_ _Y_ _PATTERN id
1 plan sur hire per 1 2 1 Plan Survey
2 plan sur design q 1 2 1 Plan Survey
3 hire per trn per 2 3 1 Hire Personnel
4 design q trn per 2 2 1 Design Questionnaire
5 design q select h 2 2 1 Design Questionnaire
6 design q print q 2 2 1 Design Questionnaire
7 trn per cond sur 3 3 1 Train Personnel
8 select h cond sur 3 1 1 Select Households
9 print q cond sur 3 2 1 Print Questionnaire
10 cond sur analyze 4 2 1 Conduct Survey
11 analyze   5 2 1 Analyze Results



Note that the data set NODEPOS contains variables named _FROM_ and _TO_, which specify the (activity, successor) information; hence, the call to PROC NETDRAW does not contain the ACTIVITY= and SUCCESSOR= specifications. The presence of the variables _X_ and _Y_ indicates to PROC NETDRAW that the data set contains the x and y coordinates for all the nodes. Because there is no variable named _SEQ_ in this data set, PROC NETDRAW assumes that only the node coordinates are given and uses these node positions to determine how the arcs are to be routed. The resulting network diagram is shown in Output 7.13.4.

  
    title2 j=l h=1.5 ' Changing Node Positions'; 
    footnote j=r 'Modified Network Layout '; 
    proc netdraw data=nodepos graphics; 
       actnet / id=(id) 
                nodefid 
                nolabel 
                carcs = blue 
                ctext = white 
                coutline = red 
                centerid 
                boxht = 3 
                htext=2 
                pcompress 
                separatearcs 
                ybetween=8; 
       run;
 


Output 7.13.4: Modified Network Layout of SURVEY Project
ndr13g4.gif (11410 bytes)

Previous Page | Next Page | Top of Page