Hello, World


Welcome to this new blog on data visualization at SAS. Our goal is to engage with you on a discussion about analytical and business graphics for reporting and interactive applications. Our primary focus will be on ODS Graphics and related topics, but we look forward to a lively discussion on all things graphical.

What is ODS Graphics?
ODS Graphics is an extension of the Output Delivery System for creating and managing graphical output from SAS procedures. Bob Rodriguez, Sr. Director for Statistical R&D sums up the importance of integrated graphics as follows: "Effective graphs are indispensable for modern statistical analysis. They reveal patterns, differences, and uncertainty that are not readily apparent in tabular output. Graphs provoke questions that stimulate deeper investigation, and they add visual clarity and rich content to reports and presentations.". For more on this topic, see Bob's paper on Statistical Graphics.

With SAS 9.3, ODS Graphics is included with Base SAS and does not require a SAS/GRAPH license.

ODS Graphics means different things to different people, but it always means modern and easy analytical graphs in SAS. The system has different components, each suitable for a different audience, as follows:

  1. Create graphs automatically from SAS procedures. No additional knowledge of graph coding is required.
  2. Create graphs using Statistical Graphics (SG) Procedures.
  3. Create graphs using ODS Graphics Designer, an interactive application.
  4. Create graphs using the Graph Template Language (GTL).

1. Automatic graphs (Audience: Statistician or Analyst):With SAS 9.2, graphs are created automatically by SAS procedures along with tables and written to the open ODS destination in the correct order. You can edit these graphs using the interactive ODS Graphics Editor. No additional knowledge of graph code is necessary, freeing the analyst to focus on the analysis task. Simply enabling the ODS Graphics system will produce these graphs along with the data tables as shown in the code and output below. With SAS 9.3, such automatic graphs are produced by default in DMS mode where ODS Graphics is on by default.

ods html;
ods graphics on;
ods select 'Analysis of Variance';
ods select 'Fit Plot';
title 'Fit Plot';
proc reg data=sashelp.class;
model Weight = Height;
ods graphics off;
ods html close;

2. Create graphs using Statistical Graphics (SG) Procedures (Audience: Graph Programmer): With SAS 9.2, you can create custom graphs using the SG Procedures. These procedures provide you a familiar and concise syntax to create graphs from the raw data or analysis results. These procedures include:

  1. The SGPLOT procedure for single cell graphs.
  2. The SGPANEL procedure for multi-cell class panels.
  3. The SGSCATTER procedure for comparative scatter plots and matrices.

The code and output for a distribution plot using the SGPLOT procedure is shown below.

title 'Distribution of City Mileage for all Cars';
proc sgplot data=sashelp.cars;
histogram mpg_city;
density mpg_city;
density mpg_city / type=kernel;
keylegend / location=inside position=topright across=1;

3. Create graphs using ODS Graphics Designer (Audience: Graph User): If you prefer to create custom graphs using an interactive application, Designer enables you to create the graph from your data using a drag and drop approach, with no knowledge of any graph code. You can view the GTL template code generated by Designer as you use the application. Graphs created in Designer can be saved and run in batch with same or different data. You can start Designer by submitting the code “sgdesign();” from the program window. In SAS 9.3, you can start Designer from the Tools menu.

The GUI for the Designer application is shown below.

4. Create graphs using the Graph Template Language (Audience: Advanced graph programmer). Complex, multi-cell graphs for clinical research and other applications can be created using GTL. The graph structure is defined in a template using the TEMPLATE procedure, and the graph is created using the SGRENDER procedure.

GTL is the common underlying system that is used by all the above methods to create graphs. So, graphs obtained from any of the above means can be used together seamlessly. You can mix automatic graphs and graphs created by SG Procedures or Designer in your report to get a consistent look.

In this blog, we will discuss various techniques, tips and tricks to create both standard and unusual graphs using the above tools. Along the way you will hear from the following contributors:

  • Sanjay Matange (Editor)
  • Dan Heath
  • Prashant Hebbar
  • Pratik Phadke

We look forward to an interesting and engaging conversation on these and other related graphical topics.

About Author

Sanjay Matange

Director, R&D

Sanjay Matange is R&D Director in the Data Visualization Division responsible for the development and support of the ODS Graphics system, including the Graph Template Language (GTL), Statistical Graphics (SG) procedures, ODS Graphics Designer and related software. Sanjay has co-authored a book on SG Procedures with SAS/PRESS.

Related Posts


  1. Pingback: mitraz

Leave A Reply

Back to Top