Scenarios for ODS Graphics Software Interactions

The ODS Graphics procedures and applications all use the Graph Template Language (GTL) for their graph definitions. The ODS Graphics software components complement each other, and can often be used together.
Here are some tasks that you can perform using different combinations of ODS Graphics software.
  • Produce a graph as part of your statistical analysis and specify the style and size of the graph.
    Here are the high-level steps:
    1. Enable ODS Graphics in your statistical procedure.
    2. In your program, specify the ODS destination and options that you want, such as the style.
    3. Use the ODS GRAPHICS statement options to control various aspects of the graph output, such as the size.
  • Produce a graph that was created in the Graph Template Language (GTL).
    Here are the high-level steps:
    1. Create a graph template using the GTL.
    2. Render the compiled template using the SGRENDER procedure.
  • Produce in batch mode a graph that was created in the ODS Graphics Designer.
    Here are the high-level steps:
    1. Create the graph using the ODS Graphics Designer.
    2. Render the graph using the SGDESIGN procedure as part of a batch. In your program, you can specify the ODS destination and any supported ODS options.
      If the SGD file has been defined with dynamic variables, then you can substitute a different value for a variable by using the DYNAMIC statement.
    3. You can also export the graph template from the ODS Graphics Designer. You can then save the code as a SAS program to be run in batch mode.
  • Annotate a graph that was generated for your analysis.
    Here are the high-level steps:
    1. Make sure that ODS Graphics is enabled for your procedure.
    2. In your program, specify the SGE= ON option in the ODS destination statement.
    3. Annotate the graph using the ODS Graphics Editor.
    4. Do either of the following:
      • Save the SGE file in the format that you want.
      • Render the SGE file using the SGRENDER procedure. In your program, you can specify the ODS destination and options that you want. You can also use the ODS GRAPHICS statement options to control various aspects of the graph output.
  • Produce an annotated ODS Graphics Designer graph for publication.
    Here are the high-level steps:
    1. Create the graph using the ODS Graphics Designer.
    2. Produce an editable graph using the SGDESIGN procedure. In your program, specify the SGE= ON option in the ODS destination statement.
    3. Annotate the graph using the ODS Graphics Editor.
    4. Do either of the following:
      • Save the file in the PNG format.
      • Save the file in the SGE format, and then render the SGE file using the SGRENDER procedure. In your program, you can specify the ODS destination and options that you want. You can also use the ODS GRAPHICS statement options to control various aspects of the graph output.
  • Customize the template for a graph that was created in the ODS Graphics Designer.
    Here are the high-level steps:
    1. Create the graph using the ODS Graphics Designer.
    2. Export the graph template from the designer.
    3. Paste the code into SAS and customize the graph template using the GTL.
    4. Render the compiled template using the SGRENDER procedure.
  • Customize the template for a graph that was created using the ODS Graphics procedures.
    Here are the high-level steps:
    1. Create a graph using the SGPLOT or the SGSCATTER procedure. In the procedure statement, specify the TMPLOUT= option. This option writes the template code for your graph to a file.
    2. In SAS, customize the exported template using the GTL.
    3. Render the compiled template using the SGRENDER procedure.
  • Produce graphs in batch mode using a custom style that was created in the ODS Graphics Designer.
    Here are the high-level steps:
    1. Create a custom style using the ODS Graphics Designer.
    2. Export the style.
    3. Execute the exported code in SAS to compile the style and save it in the style template store.
    4. Apply the style to your procedures by specifying the style in the ODS destination statement.