The DS2TREE macro generates
HTML output files for the Treeview applet. Macro arguments enable
you to generate and format an HTML file and to customize the appearance
of your node/link diagram.
Follow the steps shown
in the following code to generate a Web presentation that runs the
Treeview applet. (Note that the ODS LISTING destination must be open
when you run the DS2TREE macro.)
/* 1. Define the name and storage location of the HTML output file. */
/* and the location of the jar files. */
%let htmlfile = your_path_and_filename.htm;
%let jarfiles = http://your_path_to_archive;
/* 2. Define a data set that contains parent-child relationships. */
data myorg;
input name $ empno mgrno deptname $22. deptcode $;
cards;
Peter 2620 1420 Documentation DOC
Linda 6915 1420 Research & Development R&D
Maria 1320 1420 Legal LGL
Vince 1420 1750 Executive EXE
Jim 6710 6915 Quality Assurance QA
Nancy 22560 6915 Quality Assurance QA
Patrick 28470 6915 Quality Assurance QA
Elsa 33075 6915 Development DEV
Clement 22010 6915 Development DEV
Murielle 3020 6915 Development DEV
David 11610 6915 Research RES
;
run;
/* 3. Specify titles and footnotes: (optional). */
title1 'Organizational Chart';
footnote1 'To display the department name, place the cursor over a node.';
footnote2 'To rotate the chart, click and drag a node.';
/* 4. Close ODS HTML and open ODS LISTING. You must use the */
/* ODS LISTING destination. */
ods html close;
ods listing;
/* 5. Run the DS2TREE macro. */
/* You must change the CODEBASE= argument (using either http:// */
/* or a directory path such as C:/) to specify the location of your */
/* sas.graph.treeview.jar file and its associated jar files */
/* (sas.graph.nld.jar, sas.graph.j2d.jar). See the CODEBASE= argument in: */
/* Arguments for the APPLET Tag*/
%ds2tree(ndata=myorg, /* data sets and files */
codebase=&jarfiles,
xmltype=inline,
htmlfile=&htmlfile,
nid=empno, /* roles of variables */
nparent=mgrno,
ntip=deptname,
nlabel=name,
height=500, /* appearance */
width=600,
tcolor=navy,
fcolor=black);
/* 6. Close ODS LISTING and open ODS HTML. */
ods listing close;
ods html;
Display the resulting
HTML file in a Web browser to run the Treeview applet and display
the node/link diagram.
The preceding example
shows how the arguments of the DS2TREE macro identify a data set and
specify how the variables in that data set are to be interpreted to
generate the diagram. Appearance arguments define the size of the
diagram and the color of the text in the title and footnotes.