Chapter Contents |
Previous |
Next |
The NETDRAW Procedure |
This example illustrates the use of the Annotate Facility to draw an Activity-on-Arc network. First, PROC NETDRAW is invoked with explicit node positions for the vertices of the network. The ALIGN= and ZONE= options are used to provide horizontal and vertical axes as a frame of reference. The resulting diagram is shown in Output 5.17.1.
data widgaoa; input task $ 1-12 days tail head _x_ _y_; datalines; Approve Plan 5 1 2 1 2 Drawings 10 2 3 4 2 Anal. Market 5 2 4 4 2 Write Specs 5 2 3 4 2 Prototype 15 3 5 7 1 Mkt. Strat. 10 4 6 10 3 Materials 10 5 7 10 1 Facility 10 5 7 10 1 Init. Prod. 10 7 8 13 1 Evaluate 10 8 9 16 1 Test Market 15 6 9 18 2 Changes 5 9 10 20 1 Production 0 10 11 23 1 Marketing 0 6 12 19 2 Dummy 0 8 6 16 1 . . 11 . 26 1 . . 12 . 22 3 pattern1 v=e c=red; title j=l ' Project: Widget Manufacture'; title2 j=l ' Network in Activity-on-Arc Format'; footnote j=r 'Initial Layout '; proc netdraw graphics data=widgaoa out=netout; actnet / act=tail succ=head id=(tail) align=_x_ zone=_y_ ybetween = 10 nodefid nolabel pcompress htext=2; label _y_=' Y \ X '; run;
Output 5.17.1: Activity-on-Arc Format
In Output 5.17.1, the arc leading from vertex `4' to vertex `6' has two turning points: (10.5, 3) and (10.5, 2) (refer to the axes). Suppose that you want the arc to be routed differently, to provide a more symmetric diagram. The next DATA step creates a data set, NETIN, which changes the X coordinates of the turning points to 16.5 instead of 10.5. Further, two Annotate data sets are created: the first one labels the nodes outside the boxes, either to the top or to the bottom, and the second one sets labels for the arcs. PROC NETDRAW is then invoked with the combined Annotate data set to produce the diagram shown in Output 5.17.2.
data netin; set netout; if _from_=4 and _to_=6 and _seq_>0 then _x_=16.5; run; data anno1; set netout; if _seq_=0; /* Set up required variable lengths, etc. */ length function color style $8; length xsys ysys hsys $1; length when position $1; length text $12; xsys = '2'; ysys = '2'; hsys = '4'; when = 'a'; /* label the nodes using node numbers */ function = 'label '; size = 2; position = '5'; text = left(put(tail, f2.)); x=_x_; if _y_ = 1 then y=_y_-.3; else y=_y_+.5; run; data anno2; /* Set up required variable lengths, etc. */ length function color style $8; length xsys ysys hsys $1; length when position $1; length text $12; xsys = '2'; ysys = '2'; hsys = '4'; when = 'a'; /* label the arcs using Activity names */ function = 'label '; size = 2; position = '5'; x=2.5; y=1.8; text='Approve Plan'; output; x=5.5; y=.8; text='Drawings'; output; x=5.7; y=1.4; text='Write Specs'; output; x=7; y=3.4; text='Anal.Market'; output; x=8.5; y=.8; text='Prototype'; output; x=11.5; y=1.4; text='Facility'; output; x=11.5; y=.8; text='Materials'; output; x=14.5; y=.9; text='Init. Prod'; output; x=13.5; y=3.4; text='Mkt. Strat.'; output; x=18; y=.8; text='Evaluate'; output; x=21.5; y=.8; text='Changes'; output; x=24.5; y=.8; text='Production'; output; x=20; y=3.4; text='Marketing'; output; position=6; x=16.6; y=1.5; text='Dummy'; output; x=18.6; y=1.5; text='Test Market'; output; ; data anno; set anno1 anno2; run; footnote j=r 'Annotated and Modified Layout '; pattern1 v=s c=red; proc netdraw graphics data=netin anno=anno; actnet / nodefid nolabel boxwidth=1 pcompress novcenter vmargin=20 xbetween=10 ; run;
Output 5.17.2: Activity-on-Arc Format: Annotated Diagram
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.