ODS features: |
ODS HTML statement:
| BODY= |
| CONTENTS= |
| FRAME= |
| PAGE= | |
ODS
LISTING statement:
|
ODS OUTPUT statement:
| data set options for the output data sets |
| match_all= |
| storing the names of the
output data sets in a macro
variable | |
|
Other SAS features: |
PROC FORMAT |
PROC PRINT |
SET
statement |
KEEP= data set option |
RENAME= data set
option |
|
This example routes two output objects that PROC
TABULATE
produces to both the Output destination and the HTML destination. The result
is two output data sets and two output objects formatted as HTML output. PROC
PRINT prints the output data sets, and the resulting output object is also
routed to the HTML destination. Finally, a DATA step combines both the output
data sets into one data set, and a PROC PRINT step prints this data set as
well.
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. ![[cautionend]](../common/images/cautend.gif)
 | data energy;
length State $2;
input Region Division state $ Type Expenditures @@;
datalines;
1 1 ME 1 708 1 1 ME 2 379 1 1 NH 1 597 1 1 NH 2 301
1 1 VT 1 353 1 1 VT 2 188 1 1 MA 1 3264 1 1 MA 2 2498
1 1 RI 1 531 1 1 RI 2 358 1 1 CT 1 2024 1 1 CT 2 1405
1 2 NY 1 8786 1 2 NY 2 7825 1 2 NJ 1 4115 1 2 NJ 2 3558
1 2 PA 1 6478 1 2 PA 2 3695 4 3 MT 1 322 4 3 MT 2 232
4 3 ID 1 392 4 3 ID 2 298 4 3 WY 1 194 4 3 WY 2 184
4 3 CO 1 1215 4 3 CO 2 1173 4 3 NM 1 545 4 3 NM 2 578
4 3 AZ 1 1694 4 3 AZ 2 1448 4 3 UT 1 621 4 3 UT 2 438
4 3 NV 1 493 4 3 NV 2 378 4 4 WA 1 1680 4 4 WA 2 1122
4 4 OR 1 1014 4 4 OR 2 756 4 4 CA 1 10643 4 4 CA 2 10114
4 4 AK 1 349 4 4 AK 2 329 4 4 HI 1 273 4 4 HI 2 298
; |
 | proc format;
value regfmt 1='Northeast'
2='South'
3='Midwest'
4='West';
value divfmt 1='New England'
2='Middle Atlantic'
3='Mountain'
4='Pacific';
value usetype 1='Residential Customers'
2='Business Customers';
run; |
 | ods listing close; |
 | ods output Report(match_all=datasetnames)
=energyoutput(keep=region division type expenditures_sum
rename=(expenditures_sum=Expenditures)); |
 | ods html body='odsoutput-body.htm'
frame='odsoutput-frame.htm'
contents='odsoutput-contents.htm'
page='odsoutput-page.htm'; |
 | proc tabulate data=energy format=dollar12.;
by region;
class division type;
var expenditures;
table division,
type*expenditures;
format region regfmt. division divfmt. type usetype.;
title 'Energy Expenditures for Each Region';
title2 '(millions of dollars)';
run; |
 | ods html body='odsoutput-printbody.htm'; |
 | proc print data=energyoutput noobs;
title 'Output Data Set from the First BY Group';
run;
proc print data=energyoutput1 noobs;
title 'Output Data Set from the Second BY Group';
run; |
 | data new;
set &datasetnames;
run; |
 | proc print data=new noobs;
title 'Combined Output Data Sets';
run; |
 | ods html close;
ods output close;
ods listing; |
Links to each output object appear in the table of contents
and the table of pages on the lefthand side of the frame. Clicking on the
links in the table of contents or table of pages displays the corresponding
HTML output.
|
![[HTML Output]](../common/images/outhtml.gif) |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.