Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The NETDRAW Procedure

Example 5.15: Organizational Charts with PROC NETDRAW

This example illustrates using the TREE option to draw organizational charts. The Network data set, DOCUMENT, describes how the procedures are distributed between the two volumes of the new SAS/OR documentation. The structure can be visualized easily in a tree diagram. The data set DOCUMENT contains the parent-child relationship for each node of the diagram. For each node, a detailed description is contained in the variable ID. In addition, the variable _pattern specifies the pattern to be used for each node. PROC NETDRAW is invoked with the TREE option, which illustrates the organization of the documentation in the form of a tree diagram drawn from left to right. The CENTERID option centers text within each node. Arrowheads are not necessary for this diagram and are suppressed by specifying AROWHEAD = 0. Output 5.15.1 shows the resulting diagram.

   data document;
      input parent $ child $ id $ 20-43 _pattern;
      datalines;
   OR      MP         Operations Research       1
   OR      PM         Operations Research       1
   PM      NETDRAW    Project Management        2
   PM      GANTT      Project Management        2
   PM      DTREE      Project Management        2
   PM      CPM        Project Management        2
   MP      TRANS      Mathematical Programming  3
   MP      NETFLOW    Mathematical Programming  3
   MP      LP         Mathematical Programming  3
   MP      ASSIGN     Mathematical Programming  3
   CPM     .          CPM Procedure             2
   DTREE   .          DTREE Procedure           2
   GANTT   .          GANTT Procedure           2
   NETDRAW .          NETDRAW Procedure         2
   ASSIGN  .          ASSIGN Procedure          3
   LP      .          LP Procedure              3
   NETFLOW .          NETFLOW Procedure         3
   TRANS   .          TRANS Procedure           3
   ;
   data document;
      input parent $ child $ id $ 20-43 _pattern;
      datalines;
   OR      MPBOOK     Operations Research       1
   OR      PMBOOK     Operations Research       1
   PMBOOK  CPM        Project Management        2
   PMBOOK  DTREE      Project Management        2
   PMBOOK  GANTT      Project Management        2
   PMBOOK  NETDRAW    Project Management        2
   PMBOOK  PM         Project Management        2
   PMBOOK  PROJMAN    Project Management        2
   MPBOOK  ASSIGN     Mathematical Programming  3
   MPBOOK  LP         Mathematical Programming  3
   MPBOOK  NETFLOW    Mathematical Programming  3
   MPBOOK  NLP        Mathematical Programming  3
   MPBOOK  TRANS      Mathematical Programming  3
   CPM     .          CPM Procedure             2
   DTREE   .          DTREE Procedure           2
   GANTT   .          GANTT Procedure           2
   NETDRAW .          NETDRAW Procedure         2
   PM      .          PM Procedure              2
   PROJMAN .          PROJMAN Application       2          
   ASSIGN  .          ASSIGN Procedure          3
   LP      .          LP Procedure              3
   NETFLOW .          NETFLOW Procedure         3
   NLP     .          NLP Procedure             3
   TRANS   .          TRANS Procedure           3
   ;


   goptions ftext=swiss;
   pattern1 v=s c=blue;
   pattern2 v=s c=red;
   pattern3 v=s c=green;

   title j=l h=1.5 ' Operations Research Documentation';
   title2 j=l h=1 '  Procedures in Each Volume';
   footnote j=r h=.75 'Default Tree Layout ';
   proc netdraw graphics data=document;
      actnet / act=parent
               succ=child
               id=(id)
               nodefid
               nolabel
               pcompress
               centerid
               tree
               arrowhead=0
               xbetween=15
               ybetween=3
               rectilinear
               carcs=black
               ctext=white
               htext=2.5;
      run;

Output 5.15.1: Organization of Documentation: Default TREE Layout
ndr15g1.gif (4817 bytes)

The procedure draws the tree compactly with the successors of each node being placed to the immediate right of the node, ordered from top to bottom in the order of occurrence in the Network data set. The next invocation of PROC NETDRAW illustrates the effect of the SEPARATESONS and CENTERSUBTREE options on the layout of the tree (see Output 5.15.2).

   footnote j=r h=.75 'Centered Tree Layout ';
   proc netdraw graphics data=document;
      actnet / act=parent
               succ=child
               id=(id)
               nodefid
               nolabel
               pcompress
               novcenter
               centerid
               tree
               arrowhead=0
               separatesons
               centersubtree
               xbetween=15
               ybetween=3
               rectilinear
               carcs=black
               ctext=white
               htext=3;
      run;

Output 5.15.2: Organization of Documentation: Controlled TREE Layout
ndr15g2.gif (4592 bytes)

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.