Data Analysis using the SAS Language/Output Delivery System (ODS)

From Wikiversity
Jump to navigation Jump to search

The SAS Output Delivery System (ODS) allows SAS to create output in a multitude of forms. These include Hypertext Markup Languange (HTML), Postscript (pps), Adobe Portable Document Format (PDF), Microsoft Word (DOC), and Rich Text Format (RTF). There is very little to change in the existing code. Instead wrapper statements are use before and after the procedures and data steps from where you want to capture output. You can even specify only certain parts of the output that you want to capture. These are called output objects. Output objects can also be captured as a SAS data set and used in subsequent procedures and data steps.

Progress-0250.svg Completion status: this resource is ~25% complete.
U+269B.svg Subject classification: this is a science resource.
Bellcurve.svg Subject classification: this is a statistics resource.
Gnome-fs-client.svg Subject classification: this is an information technology resource.
Sciences humaines.svg Educational level: this is a tertiary (university) resource.

Display Delivery[edit]

Display delivery is designed for viewing output on the web. When publishing to the web, the SAS code writen to access and analyze the data does not change, instead, a shell, or envelope, of special SAS statements is placed around your code. All the output is automatically formatted for the web. This includes building tables and formatting the results. The first ODS statement defines where the output will go and which engine will be used to format the output. The last ODS statement terminates the creation of the output.

     filename webdest "c:\inetpub\wwwroot\apple_shipment.htm";
     ods html file=webdest (title="Apple Shipments"); 
     proc means data=apple;
          var shipment;
     run;
     ods html close;

The output written to the file, apple_shipment.htm, can be viewed from a web browser. If you have a web server set up, you can slow share this over the Internet.

Printer Delivery[edit]

Printer delivery is designed for preparing output using the portable document format. When creating a pdf file, the SAS code written to access and analyze the data does not change, instead, a shell, or envelope, of special SAS statements is placed around your code. All the output is automatically formatted for the pdf. This includes building tables and formatting the results. The first ODS statement defines where the output will go and which engine will be used to format the output. The last ODS statement terminates the creation of the output.

     filename mypub "c:\myfiles\apple_shipment.pdf";
     ods pdf file=mypub; 
     proc means data=apple;
          var shipment;
     run;
     ods pdf close;

The output written to the file, apple_shipment.pdf, can be viewed and printed using Adobe Acrobat Reader.

Proc Template[edit]

Proc template is used to apply formatting to what ever output destination is chosen. Templates can be designed and saved in order to produce consistent looking output.

Output Objects[edit]

The output from nearly every procedure is organized into a series of objects. These objects can be identified individually in order to be either included or excluded in the final output. The conents of each object can be stored for later use. Proc template can apply formatting to a specific part of an object.