SAS.GRAPH 9.1 Reference, Volumes I and II

The following sample programs generate Treeview diagrams:

Sample Treeview with XML Embedded in the HTML File

This sample program generates a very simple Treeview diagram.

Results Shown in a Browser

The following is the Treeview diagram that is generated by the sample code. Notice the pop-up menu. Because the diagram is displayed by the Treeview applet, it is not just a static picture. A user can manipulate the diagram, for example, by bringing selected nodes to the center, spreading out the nodes, and searching for nodes.

SAS Code

The following is the complete SAS code used to generate the Treeview diagram from a SAS data set. Note the following:

data father_and_sons; input id . name . father .; cards; aaron Aaron Parker bob Bob Parker aaron charlie Charlie Parker aaron david David Parker aaron edward Edward Parker david ; run; /* make sure ods listing is open when running macro */ ods listing; /* run the macro */ %ds2tree(ndata=father_and_sons, /* data set */ /* specify complete url if jar files are not in same directory as html file */ codebase=http:// your_path_to_archive , xmltype=inline, htmlfile= your_path_and_filename .htm, nid=id, /* use this variable as the id */ cutoff=1, /* display the name on every node */ nparent=father,/* this identifies the parent of each node */ nlabel=name, /* display this on each node */ height=400, width=400, tcolor=navy, fcolor=black);

Sample Treeview with XML Written to an External File

This sample program generates the same Treeview as the previous example, Sample Treeview with XML Embedded in the HTML File on page 507, with the difference that the XML is written to an external file instead of being embedded in the HTML file.

SAS Code

The following is the complete SAS code to generate the Treeview diagram from a SAS data set. Note the following:

data father_and_sons; input id . name . father .; cards; aaron Aaron Parker bob Bob Parker aaron charlie Charlie Parker aaron david David Parker aaron edward Edward Parker david ; run; goptions reset=all; /* make sure ods listing is open when running macro */ ods listing; /* run the macro */ %ds2tree(ndata=father_and_sons, /* data set */ codebase=http:// your_path_to_archive , htmlfile= your_path_and_filename .htm, xmltype=external, makexml=y, xmlurl=htp://www.xtz.com/weboutput_treeview2_sample.xml, xmlfile=u:/public/weboutput_treeview2_sample.xml, nid=id, /* as the id, use this variable specified here */ cutoff=1, /* display the name on every node */ nparent=father,/* this identifies the parent of each node */ nlabel=name, /* displ ay the value of this variable on each node */ height=400, width=400, tcolor=navy, fcolor=black);

Treeview with Hotspots

This sample program generates the same Treeview as the previous example, Sample Treeview with XML Embedded in the HTML File on page 507, with the difference that a node is associated with a URL and can be activated by a user double-clicking the node.

SAS Code

The following is the complete SAS code to generate the Treeview diagram from a SAS data set. Note the following:

data father_and_sons; input id . name . father . url .; cards; aaron Aaron Parker http://www.xyz.com/index.html bob Bob Parker aaron http://www.xyz.com/index.html charlie Charlie Parker aaron http://www.xyz.com/index.html david David Parker aaron http://www.xyz.com/index.html edward Edward Parker david http://www.xyz.com/index.html ; run; /* make sure ods listing is open when running macro */ ods listing; /* run the macro */ %ds2tree(ndata=father_and_sons, /* data set */ /* specify complete url if jar files are not in same directory as html file */ codebase=http:// your_path_to_archive , xmltype=inline, htmlfile= your_path_and_filename .htm, nid=id, /* as the id, use the variable specified here */ cutoff=1, /* display the name on every node */ nparent=father,/* this identifies the parent of each node */ nlabel=name, /* display the value of this variable on each node */ height=400, width=400, tcolor=navy, fcolor=black, nurl=url, driltarg=_top );

Категории