Chapter 1: Introduction to Clinical Graphics
1.1 Introduction to Output Delivery System Statistical Graphics
There are several procedures in SAS that use the Output Delivery System (ODS) Statistical Graphics software. Part of the ODS Graphics are Statistical Graphics (SG) procedures and Graph Template Language (GTL). SG procedures generate plots that are based on procedure-driven GTL templates. In other words, the templates are determined based on the plot statements and options provided within the SG procedure. In addition, you can generate graphs from several analytical procedures, such as the LIFETEST procedure. With ODS Graphics, you are able to obtain graphs automatically through the analytical procedures or create custom graphs using SG procedures or GTL (Matange, 2016).
Knowing ODS Graphics enables you to modify or add features that are based on the procedure-driven templates as well as create customized graphs that might not otherwise be possible. GTL makes it easier to incorporate features, such as embedding a table of data within the output area or displaying multiple graphs, regardless of whether the graphs are of the same or different type on the same page. Prior to GTL, these features might have been difficult to achieve. Furthermore, according to Matange (2013) some additional reasons to learn GTL are:
ā GTL provides in one system the full set of features that you need to create graphs from the simplest scatter plots to complex diagnostics panels.
ā GTL is the language used to create the templates shipped by SAS for the creation of the automatic graphs from the analytical procedures. To customize one of these graphs, you will need to understand GTL.
ā GTL represents the future for analytical graphics in SAS. New features are being added to GTL with every SAS release.
The following conventions are used in the text (and not the SAS code) within this book. Terms that are in all capital letters denote SAS procedures, SAS statements, data sets, and variables in a data set (for example, PROC SGPLOT, the SCATTER statement, the ADAE data set, and the AESTDT variable). Terms that are in italic capital letters denote macro variables (for example, SYSDATE and SYSTIME). Bold italic letters denote macros (for example, %SurvivalTemplateRestore).
1.1.1 Understanding the Basic: Statistical Graphics Procedures
SG procedures can be used to create a number of graphs. They use clear and concise syntax. SG procedures include these two procedures: SGPLOT and SGPANEL. Although there are other SG procedures, SGPLOT and SGPANEL are the only SG procedures that are used in the production of some of the graphs illustrated in the book. The SGRENDER procedure is used along with the TEMPLATE procedure to produce custom graphics. These two procedures combined are referred to as GTL in this book.
1.1.1.1 Overview of the SGPLOT Procedure
For many graphs, the SGPLOT procedure is typically sufficient. In order to use SGPLOT at least one plot statement must be specified. Within SGPLOT you can overlay different plots so that they occupy the same data area in the graph. Types of graphs that can be produced with SGPLOT include bar charts, high-low plots, block plots, series plots, and waterfall plots.
Although only one plot statement is needed, further control over the graphās appearance can be achieved with the use of additional statements. You can control various aspects such as colors and markers that are associated with a style with the use of STYLEATTRS. If there is a particular Unicode character or an image that you want to use in one or more plots specified within the SGPLOT procedure, you can define the marker symbol using the SYMBOLCHAR or SYMBOLIMAGE. In addition, you can control the axes options with the use of XAXIS, X2AXIS, YAXIS, and Y2AXIS. XAXIS and X2AXIS control the X (bottom X axis) and X2 (top X axis) respectively; while YAXIS and Y2AXIS control the Y (left Y axis) and Y2 (right Y axis) respectively.
Each statement within SGPLOT has additional options that allow for further control of the appearance. The options vary based on the plot specified, but you can change other attributes like color, text rotation, fill pattern, and line pattern. The syntax for SGPLOT is simple as illustrated in Program 1-1.
Program 1-1: SGPLOT Procedure Syntax
proc sgplot <options>;
<ā¦ plot statements ā¦> / <options>;
run;
1.1.1.2 Overview of the SGPANEL Procedure
With the SGPANEL procedure, you can create a panel of similar graphs based on one or more classification variables. In order to use SGPANEL, the PANELBY statement must be specified. The PANELBY statement determines the different combinations of the classification variables. At least one classification variable needs to be provided when using SGPANEL. With SGPANEL, SAS automatically determines the panel layout, that is, SAS determines the number of individual cells for a data area in the graph, and, if necessary, SAS creates multiple graphs if the number of unique combinations of classification variables does not fit on one graph.
Other than the use of PANELBY, SGPANEL can use the same plot statements and options to help control the appearance of each individual cell in the graph. Program 1-2 demonstrates the standard syntax for SGPANEL.
Program 1-2: SGPANEL Procedure Syntax
proc sgpanel <options>;
panelby variable / <options>;
<ā¦ plot statements ā¦> / <options>;
run;
1.1.1.3 Overview of the SGSCATTER Procedure
While the SGSCATTER procedure can be used to create a simple scatter plot of Y by X, it can also be used to create a panel of scatter plots that are based on the different combinations of variables specified. The type of panel created is determined based on whether the PLOT, COMPARE, or MATRIX statement is used. The use of PLOT, COMPARE, or MATRIX statement is required when using SGSCATTER. In addition, each one of the statements have their own set of options that enable you to control the appearance of the plots being prod...