SAS 9.4 Graph Template Language, 3rd Edition

Book description

Provides usage information and examples for the Graph Template Language (GTL). The GTL is the underlying language for the default templates that are provided by SAS for procedures that use ODS Graphics. You can use the GTL either to modify these templates or to create your own highly customized charts and plots. Information covered includes how to combine language elements to build a custom graph, creating panels that contain multiple graphs, managing plot axes, using legends, modifying style elements to control appearance characteristics, and using functions, expressions, and conditional processing.

Table of contents

  1. Contents (1/2)
  2. Contents (2/2)
  3. About this Book
    1. Using This Book
      1. Prerequisites
      2. Conventions
      3. Syntax Conventions
      4. Value-Type Notation
      5. About the Examples in This Book
  4. Recommended Reading
  5. Introduction to the Graph Template Language
    1. About the Graph Template Language
      1. What is the Graph Template Language?
      2. About ODS Graphics
        1. A Quick Overview of ODS Graphics
        2. SAS Statistical Graphics Procedures
        3. Automatic Graphics from SAS Analytical Procedures
        4. The ODS Graphics Designer
        5. The ODS Graphics Editor
      3. When You Need to Use the Graph Template Language
      4. Overview of How a Graph Is Generated by Using the GTL
        1. Steps for Generating a Graph
        2. Structure of a Basic Graph Template
        3. Compiling and Saving the Template
        4. Creating the Graph Using the SGRENDER Procedure
    2. Summary of the Graph Template Language Statements and Features
      1. Introduction to GTL Statements
        1. Statements
        2. Blocks
      2. Categories of Statements
        1. Overview of GTL Statement Categories
        2. Plot Statements
        3. Legend Statements
        4. Text Statements
        5. Layout Statements
        6. Draw Statements
        7. Annotation Statements
      3. Common Features Supported by the Plot, Layout, Legend, and Text Statements (1/2)
      4. Common Features Supported by the Plot, Layout, Legend, and Text Statements (2/2)
        1. Features Supported by Many Plot Statements
        2. Features Supported by Layout, Legend, and Text Statements
    3. Getting Started with the Graph Template Language
      1. Creating the Graph Template
      2. Compiling and Executing the Template
        1. Compiling the Template
        2. Executing the Template to Produce the Graph
      3. Managing the Graphical Output
        1. Directing Output to ODS Destinations
        2. Modifying Graph Appearance with Styles
        3. Controlling Physical Aspects of the Output
      4. Example: Building a Model Fit Plot (1/2)
      5. Example: Building a Model Fit Plot (2/2)
        1. Overview of This Example
        2. Create the Basic Scatter Plot
        3. Add the Regression Plot
        4. Add the Confidence Limit Bands
        5. Add the Legend and the Observation Count
        6. Enable the Axis Grid Lines
  6. Plots
    1. Gallery of the GTL Plots
      1. Gallery of the GTL Plots
    2. How the GTL Plot Statements are Categorized
      1. Plot Types
        1. Overview of the Plot Types
        2. Computed Plots
        3. Parameterized Plots
        4. Stand-Alone Plots
        5. Dependent Plots
        6. 2-D Plots and 3-D Plots
      2. Plot Categories
      3. Additional Plot Category: the Primary Plot
    3. Plot Statements by Category
      1. Stand-alone, 2-D, Computed Plots
      2. Stand-alone, 2-D, Parameterized Plots
      3. Stand-alone, 3-D, Parameterized Plots
      4. Dependent Plots
  7. Layouts
    1. Overview of the Graph Template Language Layouts
      1. Layouts in the GTL
      2. Layout Types
      3. Single-Cell Layout Statements
      4. Multi-Cell, Non-Data-Driven Layout Statements
      5. Multi-Cell, Data-Driven Layout Statements
      6. Axis Management
    2. Creating Overlay Graphs Using the OVERLAY Layout
      1. The LAYOUT OVERLAY Statement
      2. Statements You Can Use in an OVERLAY Block
      3. Restrictions on Allowed Statements
      4. Restrictions on Statement Combinations
      5. Statement Order
      6. Managing Axes in OVERLAY Layouts (1/11)
      7. Managing Axes in OVERLAY Layouts (2/11)
      8. Managing Axes in OVERLAY Layouts (3/11)
      9. Managing Axes in OVERLAY Layouts (4/11)
      10. Managing Axes in OVERLAY Layouts (5/11)
      11. Managing Axes in OVERLAY Layouts (6/11)
      12. Managing Axes in OVERLAY Layouts (7/11)
      13. Managing Axes in OVERLAY Layouts (8/11)
      14. Managing Axes in OVERLAY Layouts (9/11)
      15. Managing Axes in OVERLAY Layouts (10/11)
      16. Managing Axes in OVERLAY Layouts (11/11)
        1. Overview
        2. Axis Terminology
        3. How Plot Statements Affect Axis Construction
        4. Avoiding Plot Axis Conflicts
        5. Axis Line versus Wall Outline
        6. Axis Appearance Features Controlled by the Current Style
        7. Specifying Axis Options
        8. Axis Type
        9. Axis Data Range
        10. Axis Labels
        11. Axis Tick Values
        12. Axis Thresholds
        13. Axis Offsets
        14. LINEAR Axes
        15. DISCRETE Axes
        16. TIME Axes
        17. LOG Axes
      17. Avoiding Plot Data Conflicts
      18. Overlay Examples (1/3)
      19. Overlay Examples (2/3)
      20. Overlay Examples (3/3)
        1. Vertical and Horizontal Bar-Line Charts
        2. Plot with Multiple Axes
        3. Plot with Fit Line
        4. Plot with Fit Line with Confidence Bands
        5. Plot of Grouped Data
        6. Using Overlays to Graph Multiple Response Variables
        7. Plot with Insets
        8. Plot Appearance
    3. Creating Overlay Graphs With Equated Axes Using the OVERLAYEQUATED Layout
      1. The LAYOUT OVERLAYEQUATED Statement
      2. Managing Axes in OVERLAYEQUATED Layouts
        1. Types of Equated Axes
        2. Defining Axes for Equated Layouts
      3. Equated Overlay Layout Examples
    4. Creating Overlay 3-D Graphs Using the OVERLAY3D Layout
      1. The LAYOUT OVERLAY3D Statement
      2. Data Requirements for 3-D Plots (1/3)
      3. Data Requirements for 3-D Plots (2/3)
      4. Data Requirements for 3-D Plots (3/3)
        1. Overview of the Data Requirements for 3-D Plots
        2. Producing Bivariate Histograms
        3. Producing Surface Plots
      5. Managing Axes in OVERLAY3D Layouts
      6. Display Features of the OVERLAY3D Layout
        1. Managing the Display of Cube Lines
        2. Displaying a Fill in the Graph Walls
        3. Defining a Viewpoint
    5. Creating Gridded Graphs Using the GRIDDED Layout
      1. The LAYOUT GRIDDED Statement
      2. Defining a Basic Grid
        1. Setting Grid Dimensions
        2. Setting Gutters
        3. Defining Cells
      3. Building a Table of Text
      4. Sizing Issues (1/2)
      5. Sizing Issues (2/2)
        1. Row and Column Sizes
        2. Adjusting Graph Size
    6. Creating Lattice Graphs Using the LATTICE Layout
      1. The LAYOUT LATTICE Statement
      2. Defining a Basic Lattice (1/2)
      3. Defining a Basic Lattice (2/2)
        1. Setting Grid Dimensions
        2. Setting Gutters
        3. Defining Cells
        4. Adding Cell Headers
      4. Managing Axes in LATTICE Layouts (1/2)
      5. Managing Axes in LATTICE Layouts (2/2)
        1. Internal Axes
        2. Uniform Axis Ranges
        3. External Axes
      6. Adjusting the Sizes of Rows and Columns
      7. Adjusting the Graph Size
      8. Examples: Lattice Layout (1/3)
      9. Examples: Lattice Layout (2/3)
      10. Examples: Lattice Layout (3/3)
        1. Example 1: Basic Lattice with Cell Axes
        2. Example 2: Lattice with Side Bars
        3. Example 3: Lattice with External Axes
        4. Example 4: Lattice with Row Headers
        5. Example 5: Lattice with Custom Row Sizing
    7. Creating Classification Panels Using the DATALATTICE and DATAPANEL Layouts
      1. About Classification Panels
      2. The LAYOUT DATALATTICE Statement
      3. The LAYOUT DATAPANEL Statement
      4. The LAYOUT PROTOTYPE Statement
      5. Distinction between DATAPANEL and DATALATTICE
      6. Organizing Panel Contents
        1. Overview of What to Consider When Planning a Classification Panel
        2. Grid Dimensions and Cell Population Order
        3. Gutters
        4. Graph Aspect Ratio
        5. Cell Size
        6. Prototype Orientation
      7. Managing Axes in DATALATTICE and DATAPANEL Layouts
        1. Controlling Data Ranges of Rows or Columns
        2. Setting Axis Options
      8. Controlling the Classification Headers
      9. Using Sidebars
      10. Controlling the Interactions of Classifiers (1/3)
      11. Controlling the Interactions of Classifiers (2/3)
      12. Controlling the Interactions of Classifiers (3/3)
        1. Appearance of the Last Panel
        2. User Control of Panel Generation
        3. Sparse Data
        4. Missing Values
      13. Using Non-computed Plots in Classification Panels
      14. Adding an Inset to Each Cell
      15. Using PROC SGPANEL to Create Classification Panels
      16. Examples: Data Lattice Layout and Data Panel Layout (1/2)
      17. Examples: Data Lattice Layout and Data Panel Layout (2/2)
        1. Example 1: A Basic Data Lattice
        2. Example 2: A Basic Data Panel
        3. Example 3: A Data Panel with Sidebars
        4. Example 4: A Data Panel with an Inset In Each Cell
    8. Creating Graphs With No Axis Using the REGION Layout
      1. The LAYOUT REGION Statement
      2. Examples: Region Layout
        1. Example 1: Pie Chart
        2. Example 2: Bar Chart and Pie Chart
        3. Example 3: Mosaic Plot
  8. Text, Legends, and Insets
    1. Adding Titles, Footnotes, and Text Entries to Your Graph
      1. Text Strings in Graphs
      2. Text Properties and Syntax Conventions
      3. Text Statement Basics
        1. Using Titles and Footnotes
        2. Using Text Entries in the Graphical Area
      4. Managing the String on Text Statements
        1. Text Statement Syntax
        2. Using Rich Text
        3. Horizontally Aligning Text Items
        4. Generating Text Items with Dynamic Variables, Macro Variables, and Expressions
        5. Adding Subscripts, Superscripts, and Unicode Rendering
        6. Using Unicode Values in Labels
      5. Using Options on Text Statements
        1. Options Available on All Text Statements
        2. Setting Text Background, Borders, and Padding
        3. Managing Long Text in Titles and Footnotes
      6. ENTRY Statements: Additional Control
        1. Features Available for ENTRY Text
        2. Positioning ENTRY Text
        3. Rotating ENTRY Text
    2. Adding Legends to Your Graph
      1. Introduction to Legend Management
        1. Some of the Uses for a Legend
        2. Types of Legends in GTL
        3. General Syntax for Using Legends
        4. Example Legend Coding for Common Situations
      2. General Legend Features (1/2)
      3. General Legend Features (2/2)
        1. Positioning Options
        2. General Appearance Options
      4. Adding a Discrete Legend (1/4)
      5. Adding a Discrete Legend (2/4)
      6. Adding a Discrete Legend (3/4)
      7. Adding a Discrete Legend (4/4)
        1. Placing the Legend
        2. Ordering the Legend Entries for a Grouped Plot
        3. Ordering the Legend Entries for Non-grouped Plots
        4. Arranging Legend Entries into Columns and Rows
        5. Controlling the Label and Item Size
        6. Adding and Removing Items from a Discrete Legend
        7. Merging Legend Items from Two Plots into One Legend
        8. Creating a Global Legend
        9. When Discrete Legends Get Too Large
      8. Adding a Continuous Legend (1/2)
      9. Adding a Continuous Legend (2/2)
        1. Plots That Can Use Continuous Legends
        2. Positioning a Continuous Legend
        3. Using Color Gradients to Represent Response Values
        4. Scaling the Legend Values
    3. Adding Insets to Your Graph
      1. Uses for Insets in a Graph
      2. Creating a Simple Inset with an ENTRY Statement
      3. Creating an Inset as a Table of Text
      4. Positioning an Inset
      5. Creating an Inset with Values That Are Computed in the Template
      6. Creating an Inset from Values That Are Passed to the Template
        1. Overview of Importing Data into a Template
        2. Creating a Template That Uses Macro Variables
        3. Defining a Macro to Initialize the Variables and Generate the Graph
        4. Executing the Macro
      7. Adding Insets to a SCATTERPLOTMATRIX Graph
      8. Adding Insets to Classification Panels (1/2)
      9. Adding Insets to Classification Panels (2/2)
        1. About Cell Insets in Classification Panels
        2. Adding Insets By Using the Match-Merging Data Scheme
        3. Adding Insets By Using the One-To-One-Merging Data Scheme
      10. Creating Axis-Aligned Insets (1/3)
      11. Creating Axis-Aligned Insets (2/3)
      12. Creating Axis-Aligned Insets (3/3)
        1. Creating an Axis-Aligned Inset with a Block Plot
        2. Creating an Axis-Aligned Inset with an Axis Table
        3. Creating an Axis-Aligned Inset in a Classification Panel
        4. Creating an Axis-Aligned Inset with the GTL Annotation Facility
  9. Custom Graphical Elements
    1. Adding Code-Driven Graphics Elements to Your Graph
      1. Overview: Adding Non-Data-Driven Graphics Elements to a Graph
      2. Selecting the Drawing Space and Units
      3. How the Graphics Elements Are Anchored
      4. Adding Graphics Elements to Your Graph
        1. The Draw Statements
        2. Adding Text
        3. Adding Arrows and Lines
        4. Adding Geometric Shapes
        5. Adding Images
    2. Adding Data-Driven Annotations to Your Graph
      1. Overview: Adding Data-Driven Annotations to a Graph
      2. Creating an SG Annotation Data Set (1/2)
      3. Creating an SG Annotation Data Set (2/2)
        1. Adding Observations for Text Annotations
        2. Adding Observations for Arrows and Lines
        3. Adding Observations for Polylines and Polygons
        4. Adding Observations for Ovals
        5. Adding Observations for Rectangles
        6. Adding Observations for Images
      4. Using the SG Annotation Macros to Create Your SG Annotation Data Set
      5. Rendering a Graph with Annotations
      6. Subsetting Annotations
      7. Examples
        1. Creating Custom Labels
        2. Displaying Subsets of Annotations in Axis-Aligned Insets
  10. Interactive Graphs
    1. Adding Data Tips to Your Graph
      1. Creating a Graph with Data Tips in an HTML Page
      2. Creating a Graph with Custom Data Tips in an HTML Page
    2. Adding Drill-Down Links to Your Graph
      1. About Drill-Down Graphs
      2. Create a Drill-Down Graph
    3. Creating Animated Graphs
      1. About ODS Graphics Animation Support
      2. Create an Animated Graph
  11. Graphical Output
    1. Managing Your Graph’s Appearance
      1. Default Appearance Features in Graphs
      2. Methods for Changing the Appearance of Your Plots
      3. Using ODS Styles to Control Graph Appearance
        1. Evaluating Supplied Styles
        2. Changing Attributes in a Style Template
        3. Controlling ODS Search Paths
      4. Using Options to Override Style Attributes
        1. Options That Override Attributes for Individual Plots
        2. Options That Override Style Attributes for All of the Plots in a Template
      5. Controlling the Appearance of Non-grouped Data
      6. Controlling the Appearance of Grouped Data (1/4)
      7. Controlling the Appearance of Grouped Data (2/4)
      8. Controlling the Appearance of Grouped Data (3/4)
      9. Controlling the Appearance of Grouped Data (4/4)
        1. Plots That Support Grouped Data
        2. Using the Default Appearance for Grouped Data
        3. Using Custom Styles to Control the Appearance of Grouped Data
        4. Using a Discrete Attribute Map to Control the Appearance of Grouped Data
        5. Controlling the Appearance of Grouped Data for All Graphs in a Template
        6. Changing the Grouped Data Display
        7. Including Missing Group Values
        8. Changing the Grouped Data Order
        9. Making the Appearance of Grouped Data Independent of Data Order
      10. Using Attribute Maps (1/2)
      11. Using Attribute Maps (2/2)
        1. About Attribute Maps
        2. Using a Discrete Attribute Map
        3. Using a Range Attribute Map
      12. Attribute Rotation Patterns (1/2)
      13. Attribute Rotation Patterns (2/2)
        1. About the Attribute Rotation Patterns
        2. The Default Attribute Rotation Pattern
        3. The Color-Priority Attribute Rotation Pattern
      14. Using Transparency
      15. Using Data Skins
      16. Using Anti-Aliasing
      17. Using Subpixel Rendering
      18. Recommendations
    2. Managing Your Graphics Output
      1. Introduction to ODS Graphics Output
      2. SAS Registry Settings for ODS Graphics
      3. ODS Destination Statement Options Affecting ODS Graphics
      4. ODS GRAPHICS Statement Options
      5. Controlling the Image Name and Image Format
        1. Using the IMAGENAME= ODS Graphics Option to Control the Image Name
        2. Using the OUTPUTFMT= ODS Graphics Option to Control the Image Format
        3. Using a Universal Printer with ODS LISTING to Control the Image Format
        4. Resetting the Image Name and Format
      6. Controlling the Location of the Image Output
      7. Controlling Graph Size
        1. Overview of Graph Size Control
        2. BEGINGRAPH Statement
      8. Scaling Graphs
      9. Controlling Image Resolution
      10. Creating a Graph That Can Be Edited
      11. Creating a Graph That You Can Import into Microsoft Office Applications
  12. Templates
    1. Executing Graph Templates
      1. Techniques for Executing Templates
      2. Minimal Required Syntax
      3. Managing the Input Data
        1. Filtering the Input Data
        2. Performing Data Transformations
      4. Initializing Template Dynamic Variables and Macro Variables
      5. Managing the Output Data Object
        1. Setting Labels and Formats for the Output Columns
        2. Setting a Name and Label for the Output Data Object
        3. Viewing the Data Object Name and Label in the Results Window
        4. Setting a Name for the Output Image File
        5. Converting the Output Data Object to a SAS Data Set
    2. Using Dynamics and Macro Variables In Your Templates
      1. Introduction to Dynamic Variables and Macro Variables
      2. Declaring Dynamic Variables and Macro Variables
      3. Referencing Dynamic Variables and Macro Variables
      4. Initializing Dynamic Variables and Macro Variables
      5. Special Dynamic Variables
    3. Using Conditional Logic and Expressions In Your Templates
      1. Constructs Available for Run-time Programming
      2. Expressions
      3. Conditional Logic (1/2)
      4. Conditional Logic (2/2)
    4. Using Functions In Your Templates
      1. Overview
      2. SAS Functions
        1. SAS Functions That Can Be Used in a GTL Template
        2. SAS Functions That Can Be Used to Create Flexible Templates
        3. Examples of Using the IFC and IFN SAS Functions
      3. Functions Defined Only in GTL
        1. GTL Functions Used with the EVAL Function
        2. Examples
        3. Using the TYPEOF SAS Function
      4. GTL Summary Statistic Functions
        1. Commonly Used Summary Statistic Functions
        2. Example
    5. Sharing Your Custom Templates
      1. Creating Shared Templates
    6. Modifying Predefined Templates
      1. Predefined Templates for SAS Analytical Procedures
      2. Modify a Predefined Template
  13. Appendices
    1. Reserved Keywords and Unicode Values
    2. Graph Style Elements Used by ODS Graphics
      1. About the Graphical Style Elements
      2. General Graph Appearance Style Elements
      3. Graphical Data Representation Style Elements (Non-Grouped Data)
      4. Graphical Data Representation Style Elements (Grouped Data)
      5. Display Style Elements
    3. Display Attributes
      1. General Syntax for Attribute Options
      2. Attributes Available for the Attribute Options
        1. Fill Options
        2. Line Options
        3. Marker Options
        4. Text Options
      3. Available Line Patterns
    4. Tick Value Fit Policy Applicability
    5. SAS Formats Not Supported
      1. Using SAS Formats
      2. Unsupported Numeric Formats
      3. Unsupported Date and Time Formats Related to ISO 8601
      4. Other Unsupported Date and Time Formats
      5. Unsupported Currency Formats
    6. Memory Management for ODS Graphics
      1. SAS Options Affecting Memory
      2. Managing a Java Out of Memory Error
    7. ODS Graphics and SAS/GRAPH
  14. Glossary (1/3)
  15. Glossary (2/3)
  16. Glossary (3/3)
  17. Index (1/5)
  18. Index (2/5)
  19. Index (3/5)
  20. Index (4/5)
  21. Index (5/5)

Product information

  • Title: SAS 9.4 Graph Template Language, 3rd Edition
  • Author(s): SAS Documentation
  • Release date: August 2014
  • Publisher(s): SAS Institute
  • ISBN: 9781629593128