STAT-3094 - Lecture 5 - HTML Output with ODS PDF

Title STAT-3094 - Lecture 5 - HTML Output with ODS
Author M.R. Smith
Course SAS Programming
Institution Virginia Polytechnic Institute and State University
Pages 3
File Size 241 KB
File Type PDF
Total Downloads 72
Total Views 117

Summary

Lecture number corresponds to the module number for the course.
Professor: EP Smith...


Description

Daniel T. Eisert

STAT-3094

5 – HTML Output Using the O Output utput Deliv Delivery ery System ((ODS) ODS) Data Presentation: ODS

ODS Syntax

ODS HTML

ODS HTML

The Output Delivery S System ystem (ODS) allows the user to designate where to send output created from SAS procedures. By default, SAS 9.3/9.4 uses the HTML ODS to display output; older versions use the Listing ODS to display output. ODS can also be outputted as a listing (output window), another SAS dataset, a RTF (rich text format), a printer friendly document (PSs, PDF, etc.), and of course HTML (internet file). By default, the HTML ODS is turned on. SAS will send output to the HTML window until the HTML switch is cut off.  EXAMPLE: Opening and closing in general ods open_destination ; ods close_destination close;  EXAMPLE: All ODS switches can be cut off at the same time by doing the following: ods _all_ close;  EXAMPLE: ODS Syntax for HTML (instead of the keyword file, you can also use the keyword body ). ods html file = ‘location_to_save_html_file’; ods html close;  EXAMPLE: SAS will output the results from the PROC MEANS procedure to the output screen and the HTML file will be created. If there was more SAS code after the code above that produced more output, it would only be sent to the output window (if active) since the ODS HTML switch is turned off. ods html body = ‘C:/payroll_file.html’; proc means data = it.employee_data; run; ods html close; - Output can also be sent to more than one destination. Suppose you switch on the HTML ODS without switching off the Listing ODS. Your output will be copied to both the HTML file and the output window. Overwriting - If you run the SAS code again, SAS will overwrite the existing HTML file. - SAS does not append unless there is multiple procedures in one ODS block.  EXAMPLE: SAS will place the output from both procedures in the HTML file. The output will be separated by a horizontal line. This output will overwrite the HTML file that was created in the previous example. The output from both procedures will be in the same file. ods html body = ‘C:/payroll_file.html’; proc means data = it.employee_data; run; proc freq data = it.employee_data; tables employee_gender * marital_status; run; ods html close;

Multiple Procedure Outputs - If you place more than one PROC statement inside of an ODS block, SAS will put all of the output from those procedures into the HTML file

1

Daniel T. Eisert

ODS HTML Enhancements

STAT-3094 separated by a horizontal line. - If you want to separate HTML files for each PROC statement output, make separate ODS HTML blocks for each procedure. File denotes the location to save the new HTML file. Contents creates the HTML code that creates the table of contents. The table of contents contains links to specific output in the body HTML file. Frame creates the HTML file that integrates (or links) the HTML file from the body keyword and the HTML file from the contents keyword together.  EXAMPLE: Create an HTML file containing all three outputs and create the results in the output window (listing is defaulted to on).

-

You can add the path statement to designate that all three files are located in the same subdirectory such that:

-

Creating a W Website ebsite

You then don’t need to mention the drive and subdirectory for the file, contents, and frame keywords. If we wanted to upload output onto a web server, the above example would not be the best coding procedure because the web server is going to go to the C: drive of the computer being used to find the files. Therefore, the only way to access the file on the Internet is to use that very same computer anytime it needs to be accessed. If the customer wants to try and access the files from their own computer, the source code will tell the customer’s computer to check on their own C: drive which won’t work. URL keyword will adjust the source code so that is does not go to the current computer being used to find the file and contents HTML files. These files will still be created and stored in the computer location specified in the SAS code, but the source code will refer to accessing the files on the web server. Doing the following will adjust the source code so that it will look for the files locally on the web server. This will only work if all the files are located in the same directory.

Creating a W Website ebsite

What if the three files are not in the same location? We can adjust the code to fix the issue using the URL keyword. We will have to provide the HTTP website where the files are located.

2

Daniel T. Eisert

STAT-3094 

Other K Keywords eywords

EXAMPLE: The SAS code will now adjust the source code that that it will look for the files locally on the web server.

The Style keyword changes the features of the output within the HTML file.

Style Options BRICK LISTING RTF 

DEFAULT JOURNAL ANALYSIS

STATISTICAL JOURNAL2

EXAMPLE: To use the STYLE keyword, simply add it like such below the frame keyword. style = analysis;

3...


Similar Free PDFs