ODS features: |
|
Other SAS features: |
PROC FORMAT |
PROC SORT |
PROC
TABULATE |
NOBYLINE|BYLINE system option |
#BYVAL parameter in
titles |
|
This
example creates a separate HTML file for each page of procedure output. The
table of contents and table of pages do not appear any different or behave
any differently from those that would be created if all the output were in
a single file. Because the output is in separate files, you cannot scroll
from one page of output to the next. However, you can select individual HTML
files to include in a report.
Note: This example uses file names that may not be valid
in all operating environments. To successfully run the example in your operating
environment, you may need to change the file specifications. See Alternative ODS HTML Statements for Running Examples in Different Operating Environments.
| data grain_production;
length Country $ 3 Type $ 5;
input Year country $ type $ Kilotons;
datalines;
1995 BRZ Wheat 1516
1995 BRZ Rice 11236
1995 BRZ Corn 36276
1995 CHN Wheat 102207
1995 CHN Rice 185226
1995 CHN Corn 112331
1995 IND Wheat 63007
1995 IND Rice 122372
1995 IND Corn 9800
1995 INS Wheat .
1995 INS Rice 49860
1995 INS Corn 8223
1995 USA Wheat 59494
1995 USA Rice 7888
1995 USA Corn 187300
1996 BRZ Wheat 3302
1996 BRZ Rice 10035
1996 BRZ Corn 31975
1996 CHN Wheat 109000
1996 CHN Rice 190100
1996 CHN Corn 119350
1996 IND Wheat 62620
1996 IND Rice 120012
1996 IND Corn 8660
1996 INS Wheat .
1996 INS Rice 51165
1996 INS Corn 8925
1996 USA Wheat 62099
1996 USA Rice 7771
1996 USA Corn 236064
; |
| proc sort data=grain_production;
by year country type;
run; |
| proc format;
value $cntry 'BRZ'='Brazil'
'CHN'='China'
'IND'='India'
'INS'='Indonesia'
'USA'='United States';
run; |
| ods listing close; |
| ods html file='grain-body.htm'
contents='grain-contents.htm'
frame='grain-frame.htm'
page='grain-page.htm
base='http://www.yourcompany.com/local-address/' |
| newfile=page; |
| options nobyline;
title 'Leading Grain-Producing Countries';
title2 'for #byval(year)'; |
|
proc report data=grain_production nowindows
headline headskip;
by year;
column country type kilotons;
define country / group width=14 format=$cntry.;
define type / group 'Type of Grain';
define kilotons / format=comma12.;
footnote 'Measurements are in metric tons.';
run; |
| options byline;
title2; |
| proc tabulate data=grain_production format=comma12.;
class year country type;
var kilotons;
table year,
country*type,
kilotons*sum=' ' / box=_page_ misstext='No data';
format country $cntry.;
footnote 'Measurements are in metric tons.';
run; |
| ods html close;
ods listing; |
This frame file shows the first body file. Links in
the table of contents and the table of pages point to the other body files.
|
|
These HREF= attributes from the links in the contents
file point to the HTML tables that ODS creates from the PROC REPORT and PROC
TABULATE steps.
HREF="http://www.yourcompany.com/local-address/grain-body.htm#IDX"
HREF="http://www.yourcompany.com/local-address/grain-body1.htm#IDX1"
HREF="http://www.yourcompany.com/local-address/grain-body2.htm#IDX2"
HREF="http://www.yourcompany.com/local-address/grain-body3.htm#IDX3"
Notice how these HREF attributes are constructed:
- The value of the BASE= option provides the first
part of the HREF, which is http://www.yourcompany.com/local-address/. This part of the HREF is the same for all the links that
ODS creates.
- The value of the BODY= option,
grain-body
, provides the basis for the next part of the HREF.
However, because NEWFILE= creates a new file for each output object, ODS increments
this base value each time that it creates a file. The resulting file names
become part of the HREF. They are grain-body.htm
, grain-body1.htm
, grain-body2.htm
,
and grain-body3.htm
.
- The value of the ANCHOR= option provides the basis
for the last part of the HREF, which follows the pound sign (#). Because the
ANCHOR= option is not used in this example, ODS uses the default value of
IDX. With each use, ODS increments the value of the anchor.
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.