The NETDRAW Procedure |
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
The Layout data set produced by PROC NETDRAW (displayed in Output 7.13.2) contains the and 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 and 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 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 Setdata 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
|
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 and 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;
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.