The Output Delivery System

advertisement
SAS Software
Version 8
The Output Delivery
System
What is ODS?
SAS Software Version 6 produced
traditional monospace output
Other current software is WYSIWYG with
control over fonts, colours etc
Version 8 has ODS to cover the
difference, and more…
How Does ODS Work
Data
Table
Component
Definition
Output
Object
ODS
Output:
SAS
Listing
HTML
Printer
?? Future
DataSet
Output
Output
Output
Expansion
ODS Sources
Sources of ODS include:
• SAS Procedures (including
SAS/GRAPH)
• The Data Step (ODS option in the FILE
statement)
Sample ODS
Stop writing to the
...
Output Window
ODS LISTING CLOSE;
ODS HTML BODY=‘OUTPUT1.HTM’;
PROC PRINT …;
RUN;
ODS HTML CLOSE;
ODS LISTING;
...
Write to the specified
HTML File
Stop writing to the
HTML File
Write to the Output
Window again
ODS Example 1
ODS Example 1
ods html body='Test1.htm';
proc print data=work.Launchers noobs label;
title 'SPLATT Launch Vehicles';
run;
proc print data=work.Voyages heading=h noobs label;
id Voyage_ID;
by notsorted Launcher;
pageby Launcher;
title 'SPLATT Voyages';
run;
ods html close;
NOTE: Entire sample code is
located on the Notes page
for this slide..
ODS Example 2
ODS Example 2
ods html file='Test2-body.htm'
contents='Test2-contents.htm'
frame='Test2-frame.htm'
body='Test2-page.htm';
proc tabulate data=work.Voyages;
title 'SPLATT Voyages Summary';
class Launcher Mission_Success;
var Mission_Cost;
table Launcher,
Mission_Success*N=' '*f=8.0 Mission_Cost*(SUM MEAN)*f=dollar13.0;
run;
pattern1 c=red v=solid;
pattern2 c=green v=solid;
proc gchart data=work.Voyages;
title 'SPLATT Voyages Summary';
vbar Mission_Success / group=Launcher subgroup=Mission_Success nolegend;
run;
quit;
ods html close;
PROC TEMPLATE Features
PROC TEMPLATE creates and modifies
these definitions, which ODS uses to
create formatted output.
STYLE: Customize the presentation of all
output.
TABLE: Customize a single output object.
PROC TEMPLATE Example 1
PROC TEMPLATE Example 1
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
define style customdefault;
parent=styles.default;
replace color_list /
'fgB2' = cx0066AA
'fgB1' = cx004488
'fgA4' = cxFFFFFF
'bgA4' = cx880000
'bgA3' = cxBBBB00
'fgA2' = cx000000
'bgA2' = cx999900
'fgA1' = cx000000
'bgA1' = cxF0F0F0
'fgA' = cx002288
'bgA' = cx640064;
replace titlesandfooters /
foreground=cxFFFFFF font=fonts("titlefont2") font_size=6;
style header from header /
font_style=italic;
style table from table /
rules=cols cellspacing=0 borderwidth=2;
end;
run;
ods html body='Tabulate2.htm' style=customdefault;
proc tabulate data=work.Voyages;
title 'SPLATT Voyages Summary';
class Launcher Mission_Success;
var Mission_Cost;
table Launcher,Mission_Success*N=' '*f=8.0 Mission_Cost*(SUM MEAN)*f=dollar13.0;
run;
ods html close;
PROC TEMPLATE Example 2
PROC TEMPLATE Example 2
ods html body='Tabulate3.htm' style=customdefault;
proc format;
value meantl low-100000000='Green'
100000000<-150000000='Yellow'
150000000<-high='Red';
run;
proc tabulate data=work.Voyages;
title 'SPLATT Voyages Summary';
class Launcher Mission_Success;
var Mission_Cost;
table Launcher,Mission_Success*N=' '*f=8.0
Mission_Cost*(SUM MEAN*[s=[foreground=meantl.]])*f=dollar13.0;
run;
ods html close;
Conclusion
ODS provides an easy way to create
HTML pages
Easy Traffic Lighting
Futures may include XML and PDF Files
Try it!!!
Questions
References:
SAS Online Doc® Version Eight
The Complete Guide to the SAS Output Delivery System
michael_matthews@qual-it.com.au
http://www.qual-it.com.au
Download