The NETDRAW Procedure

Example 7.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 two volumes of the 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 ARROWHEAD=0. Output 7.15.1 shows the resulting diagram.

  
    data document; 
       format parent child $8. id $24.; 
       input parent $ child $ id & _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   INTPOINT   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 
    INTPOINT .          INTPOINT Procedure        3 
    LP       .          LP Procedure              3 
    NETFLOW  .          NETFLOW Procedure         3 
    NLP      .          NLP Procedure             3 
    TRANS    .          TRANS Procedure           3 
    ; 
  
    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=3; 
       run;
 

Output 7.15.1: Organization of Documentation: Default TREE Layout
ndr15g1.gif (15320 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 7.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.5; 
       run;
 

Output 7.15.2: Organization of Documentation: Controlled TREE Layout
ndr15g2.gif (13963 bytes)

Previous Page | Next Page | Top of Page