| www.sas.com > SAS UK > In the Know Homepage | Search | Contact Us |
|
|
|
|
Using the SAS Output Delivery System (ODS), you can create, customise, and manage HTML output in any operating environment by submitting programming statements. After creating HTML files, you can view them using Internet Explorer, Netscape Navigator, or any Web browser that fully supports HTML 3.2. ODS gives you new formatting options and makes procedure output much more flexible. With ODS, you can easily create HTML, RTF, PCL, PS, XML, Latex and PDF output, an output data set of procedure results and traditional SAS listing output. Also, ODS stores your output in its component parts (data and table definition) so that numerical data retains its full precision. Procedure output is divided into components, or output objects. Depending on the procedure that you run you might have one or several output objects created. For example proc print would create just one output object but proc univariate would produce multiple output objects. ODS stores a link to each output object in the results window. Using ODS programming statements we can control what output objects we are interested in and what ODS destinations we want to send them to. In order to start creating HTML, RTF, PDF files etc. you will need a few ODS statements to get you started. By default SAS output still goes to the output window. In order to send the output elsewhere you need to open the appropriate destination. The example below turns off the listing destination (the output window) and opens the HTML destination so that it is ready to receive our output. When the HTML destination is closed the class.html file is created and the HTML destination is closed:
For more information on ODS statements have a look at the section in the online documentation entitled 'The complete guide to the output delivery system'. Each output object can be broken down into two parts. Firstly we have the data component. This is the actual raw numbers and characters, which make up our SAS output. Secondly there is the template component. This is a description of how the data is to be formatted and arranged. ODS uses two different type of templates, style and table. Style templates are an abstract description of how ODS should display the presentation aspects of a SAS job. This will include things like colour, font size and font face. Table templates are used by ODS to control tabular output. This includes things like the text and order of column headers, column ordering and formats for data. Because not all output from SAS procedures can be fitted into a generic table definition there are some procedures that do not use a table template. This includes output from Proc print, proc report and proc tabulate. Even though these procedures don't use table templates you can still customise the style aspects of your output by using the STYLE= option. The example below right justifies the three variables as well as changing the background colour to red and the font style to italic:
Proc template can be a tricky procedure to get to grips with but it does give you a very powerful tool with which you can customise your output. For all things ODS you should visit http://support.sas.com/rnd/base/index-ods-resources.html , which is a treasure trove of sample code, FAQ's and tips and tricks. For proc template queries view the FAQ at http://support.sas.com/rnd/base/topics/templateFAQ/Template.html. Below are five common ODS queries that we often receive in Customer Support:
1. When using the RTF destination Can I get my page numbers in page X of Y format?
1. When using the RTF destination Can I get my page numbers in page X of Y format?
2. How can I add a hyperlink to my title? Starting with Release 8.1, you can add a hyperlink individually in a TITLE statement by using the LINK= option. See example 2. Another approach would be to use the URL= attribute within the style element SystemTitle. Using this approach, every title would specify the same the same anchor to go to, and every title would be a hyperlink. See example 3.
3. How can I add a background image to the current HTML PAGE?
4. Is there a way to increase the size of the cells in the table?
5. How can I specify a place to break my labels in HTML?
Back to Top
|