The ODS HTML destination
enables you to link to your results from a table of contents and a
table of pages. To do this, you need to create the following HTML
files: a body file, a frame file, a table of contents, and a table
of pages. When you view the frame file and select a link in the table
of contents or the table of pages, the HTML table that contains the
selected part of the procedure results appears at the top of your
browser.
The following example
creates multiple pages of output from the UNIVARIATE procedure. You
can access specific output results (tables) from links in the table
of contents or the table of pages. The results contain statistics
for the average SAT scores of entering first-year college classes.
The output is grouped by the value of Gender in the CLASS statement
and by the value of Test in the BY statement.
options nodate nonumber;
proc sort data=sashelp.prdsale out=prdsale;
by Country;
run;
1ods html file='SalesFig–body.htm'
contents='SalesFig–contents.htm'
page='SalesFig–page.htm'
frame='SalesFig–frame.htm';
2proc tabulate data=prdsale;
class region division prodtype;
classlev region division prodtype;
var actual;
keyword all sum;
keylabel all='Total';
table (region all)*(division all),
(prodtype all)*(actual*f=dollar10.) /
misstext=[label='Missing']
box=[label='Region by Division and Type'];
run;
title 'Actual Product Sales';
title2 '(millions of dollars)';
3proc univariate data=prdsale;
by Country;
var actual;
run;
title 'Sales Figures for First Quarter by Product';
4proc sgpanel data=prdsale;
where quarter=1;
panelby product / novarname;
vbar region / response=predict;
vline region / response=actual lineattrs=GraphFit;
colaxis fitpolicy=thin;
rowaxis label='Sales';
run;
5ods html close;
6ods html;
1 |
The
ODS HTML statement opens the HTML destination and creates four types
of files:
-
the body file (created with the
FILE= option), which contains the formatted data
-
the contents file, which is a table
of contents with links to items in the body file
-
the page file, which is a table
of pages with links to items in the body file
-
the frame file, which displays
the table of contents, the table of pages, and the body file
|
2 |
The
TABULATE procedure creates a summary report for actual product sales.
|
3 |
The
UNIVARIATE procedure creates moments, basic measures, quantiles, and
extreme observations tables for the actual sales for each country.
|
4 |
The
SGPANEL procedure creates a graph of the sales figures for the first
quarter by product.
|
5 |
The
ODS HTML CLOSE statement closes the HTML destination to make output
available for viewing.
|
6 |
The
ODS HTML statement reopens the HTML destination so that the next program
that you run can produce HTML output.
|
The following SAS log
shows that four HTML files are created with the ODS HTML statement:
Log 34.1 Partial SAS Log: HTML File Creation
1 options nodate nonumber;
2 proc sort data=sashelp.prdsale out=prdsale;
3 by Country;
4 run;
NOTE: There were 1440 observations read from the data set SASHELP.PRDSALE.
NOTE: The data set WORK.PRDSALE has 1440 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
5
6 ods html file='SalesFig–body.htm'
7 contents='SalesFig–contents.htm'
8 page='SalesFig–page.htm'
9 frame='SalesFig–frame.htm';
NOTE: Writing HTML Body file: SalesFig–body.htm
NOTE: Writing HTML Contents file: SalesFig–contents.htm
NOTE: Writing HTML Pages file: SalesFig–page.htm
NOTE: Writing HTML Frame file: SalesFig–frame.htm
10
11
12 proc tabulate data=prdsale;
13 class region division prodtype;
The following output
displays the frame file, name SalesFig-frame.htm, which displays the
table of contents (upper left side), the table of pages (lower left
side), and the body file (right side). Both the Table of Contents
and the Table of Pages contain links to the results in the body file.
If you click on a link in the Table of Contents or the Table of Pages,
SAS displays the corresponding results at the top of the browser.
Display 34.8 View of the HTML Frame File SalesFig-frame.htm