This example generates
a very simple Treeview diagram. The following figure shows the Treeview
diagram that is generated by the sample code in a Web browser. Notice
the pop-up menu, which appears when you right-click in the diagram.
Because the diagram is displayed by the Treeview applet, it is not
just a static picture. You can manipulate the diagram, for example,
by bringing selected nodes to the center, spreading out the nodes,
and searching for nodes. You can also access the Help information
for the Treeview applet.
See Interactivity Enabled by the Treeview Applet.
Here is the example
program code. As you review the code, notice the following:
-
The parameter XMLTYPE=INLINE tells
the DS2TREE macro that the XML that it generates from the SAS data
set should be included inline in the HTML file.
-
The parameter HTMLFILE= specifies
the complete path and name of the HTML file to be created by the DS2TREE
macro. If you want to run this sample, then change the values of HTMLFILE
and CODEBASE to the locations that you want to use.
-
The parameter CUTOFF=1 specifies
that every node on the graph be labeled. Use this parameter to suppress
node labels for diagrams with numerous nodes.
data father_and_sons;
input id $8. name $15. father $8.;
cards;
aaron Aaron Parker
bob Bob Parker aaron
charlie Charlie Parker aaron
david David Parker aaron
edward Edward Parker david
;
run;
/* close ODS HTML and open ODS LISTING */
ods html close;
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);
/* close ODS LISTING and open ODS HTML */
ods listing close;
ods html;