Click Headings Above to View Content Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Abstract Why Learn GTL It’s a Great Time to Learn GTL! Do you want to be more confident when producing GTL graphs? Do you want to know how to layer your graphs using the OVERLAY layout and build upon your graphs using multiple LAYOUT statement? Layouts Single cell Why Learn GTL? Multi-cell Allow for modifications of pre-defined templates Create graphs that cannot be produced from a pre-defined template Easier to incorporate features, such as embedded tables or display different graphs on the same page Per Sanjay Matange (2013, p.5) 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. Layout Syntax 2-Step Process Single-Cell Example Multi-Cell Example Conclusions Click Headings Above to View Content
Great Time to Learn GTL Single Cell vs Multi-Cell Graph Area Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Single Cell vs Multi-Cell Why Learn GTL Title/Top Axis Label Graph Area Layouts Single cell Side Title/Left Axis Label Side Title/Right Axis Label Multi-cell Title/Top Axis Label Layout Syntax Footnote/Bottom Axis Label 2-Step Process Side Title / Left Axis Label Side Title/Right Axis Label Single-Cell Example Output Area Multi-Cell Example Footnote/Bottom Axis Label Conclusions Note that for Multi-cell layouts each cell can have its own set of axes depending on the layout used. Click Headings Above to View Content
Click Headings Above to View Content Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Single Cell Layouts Why Learn GTL A graph which uses the entire graphing area OVERLAY: General layout with 2-D plots OVERLAYEQUATED: Overlay with equated axes PROTOTYPE: Specialized, used with DATAPANEL or DATALATTICE only REGION: General plot with no axes OVERLAY3D: General layout with 3-D plots Layouts Single cell Multi-cell Layout Syntax 2-Step Process Single-Cell Example Multi-Cell Example For examples refer to Single Cell Examples https://blogs.sas.com/content/graphicallyspeaking/2017/07/24/lollipop-charts/ https://blogs.sas.com/content/graphicallyspeaking/2017/04/30/getting-started-with-sgplot-histograms/ Conclusions Click Headings Above to View Content
Click Headings Above to View Content Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Multi-cell Layouts Why Learn GTL Pre-defined: A graph that breaks the graphing area into pre-defined portions so that each portion represents different pieces of information. GRIDDED: multi-cell plots have the same proportion in regards to height and width. LATTICE: very flexible, which allows each cell to have different heights and widths. Both GRIDDED and LATTICE can be used along with the OVERLAY layout. With these two layouts other types of layouts can be nested within each cell. Data-driven (2-D: Panels of similar graphs based on data classification variables): A graph that breaks the graphing area into as many parts necessary based on the data DATAPANEL: Number of cells based on crossings of n classification variables DATALATTICE: Number of cells based on crossings of 1 or 2 classification variables. Both DATAPANEL and DATALATTICE need to use the PROTOTYPE layout. Layouts Single cell Multi-cell Layout Syntax 2-Step Process Single-Cell Example Multi-Cell Example For examples refer to Multi-Cell Examples https://blogs.sas.com/content/graphicallyspeaking/2012/12/03/most-frequent-ae-sorted-by-relative-risk/ https://blogs.sas.com/content/graphicallyspeaking/2014/02/22/datalattice-with-gradient-backgrounds/ Conclusions Click Headings Above to View Content
Click Headings Above to View Content Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting General Syntax for OVERLAY and GRIDDED Why Learn GTL layout type </options>; GTL Plot Statements … e.g., SCATTERPLOT, SERIESPLOT, BOXPLOT, etc. <innermargin </options>; block-plot or axis-table statements; end innermargin;> endlayout; Layouts OVERLAY and PROTOTYPE Only Single cell General Syntax for LATTICE Multi-cell layout LATTICE </options>; … <columnaxes </options>; columnaxis/axis-option(s); endcolumnaxes;> <column2axes </options>; endcolumn2axes;> <rowaxes </options>; rowaxis/axis-option(s); endrowaxes;> … <row2axes </options>; rowaxis / axis-option(s); endrow2axes;> <columnheaders; endcolumnheaders;> <rowheaders; endrowheaders;> <sidebar </options>; endsidebar;> endlayout; Layout Syntax 2-Step Process Single-Cell Example Multi-Cell Example Conclusions Click Headings Above to View Content
Click Headings Above to View Content Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Step 1 Why Learn GTL Use STATGRAPH template to define structure of the graph. proc template; define statgraph templatename; begingraph / <options>; layout type / <options>; … GTL SAS code … endlayout; endgraph; end; run; Layouts Begin / End Template Definition Begin / End Graph Specifications Single cell Begin / End Layout Specifications Specify Plot Type(s) and Other GTL Statements Multi-cell Layout Syntax 2-Step Process Step 2 Single-Cell Example Produce the graph by associating the data with the template. proc sgrender data = datasetname template = templatename; <optional SAS statements>; run; Specify Input Data Multi-Cell Example Associate Template Conclusions Click Headings Above to View Content
Click Headings Above to View Content Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Example: Single Cell Layout With Nested Layout Why Learn GTL Layouts Single cell Multi-cell Click to see Code Layout Syntax 2-Step Process Single-Cell Example Multi-Cell Example Conclusions The data set used here is from the CDISC SDTM / ADaM Pilot Project and this was obtained from the CDISC website (CDISC, 2013). Click Headings Above to View Content
Click Headings Above to View Content Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Example: Single Cell Layout With Nested Layout - Code Why Learn GTL proc template; define statgraph recrgrphg; mvar valuechi054 pchi054 valuechi081 pchi081 cmstat cmpvalue; begingraph / border = false; layout overlay / xaxisopts = (label = " " type = discrete) yaxisopts = (label = "Percentage of Patients with Dermatologic Event (%)" linearopts = (tickvaluesequence = (start=0 end=100 increment=25) viewmin=0 viewmax=100)); barchart x = TRTAN y = PCT_ROW / orient = vertical barlabel = true; layout gridded / columns = 4 order = rowmajor autoalign = (top); entry "Pearson's Chi-square Test Results"; entry " "; entry " "; entry "Cochran-Armitage Trend Test Results"; entry " Treatment Comparison"; entry "Value"; entry "P-value"; entry " Value = " cmstat; entry " Placebo - Low Dose"; entry valuechi054; entry pchi054; entry "P-value = " cmpvalue; entry " Placebo - High Dose"; entry valuechi081; entry pchi081; endlayout; endgraph; end; run; proc sgrender data = PCT template = recrgrphg; format TRTAN trt. PCT_ROW pctfmt.; Macro variables used to populate table Layouts Specify layout and necessary options Single cell Multi-cell Specify GTL statement to produce output Layout Syntax Nested layout to embed results table 2-Step Process Single-Cell Example Click to see Graph Multi-Cell Example Conclusions Click Headings Above to View Content
Click Headings Above to View Content Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Example: Multi-Cell Layout Using Lattice Why Learn GTL Layouts Single cell Multi-cell Click to see Code Layout Syntax 2-Step Process Single-Cell Example Multi-Cell Example Conclusions The data set used here is from the CDISC SDTM / ADaM Pilot Project and this was obtained from the CDISC website (CDISC, 2013). Click Headings Above to View Content
Click Headings Above to View Content Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Example: Multi-Cell Layout Using Lattice - Code Why Learn GTL proc template; define statgraph recrgrphg; mvar valuechi054 pchi054 valuechi081 pchi081 cmstat cmpvalue; begingraph / border = false; layout lattice / rows = 2 rowweights = (0.2 0.8); layout overlay / yaxisopts=(display=none) yaxisopts=(display=none); /* portion to embed table – 4 columns entered in row order */ layout gridded / columns = 4 order = rowmajor autoalign = (top); entry "Pearson's Chi-square Test Results"; entry " "; entry " "; entry "Cochran-Armitage Trend Test Results"; entry " Treatment Comparison"; entry "Value"; entry "P-value"; entry " Value = " cmstat; entry " Placebo - Low Dose"; entry valuechi054; entry pchi054; entry "P-value = " cmpvalue; entry " Placebo - High Dose"; entry valuechi081; entry pchi081; endlayout; layout overlay / xaxisopts = (label = " " type = discrete) yaxisopts = (labelsplitchar="#" labelfitpolicy=splitalways label = "Percentage of Patients with Dermatologic#Event (%)" linearopts = (tickvaluesequence = (start = 0 end = 100 increment = 25) viewmin = 0 viewmax =100)); barchart x = TRTAN y = PCT_ROW / orient = vertical barlabel = true; endgraph; end; run; Macro variables used to populate table Layouts Specify lattice layout and necessary options Single cell Specify layout for first individual cell in lattice. This layout will have a nested layout (i.e., layout nested within a layout nested within a layout) Multi-cell Layout Syntax Click to see Graph 2-Step Process Single-Cell Example Multi-Cell Example Specify layout for second cell in lattice. Within this layout specify any GTL statements needed. Conclusions Click Headings Above to View Content
Click Headings Above to View Content Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Conclusion Why Learn GTL There are many types of plots with various types of options. The types of graphs that can be produced are limitless. We only touched a very small portion of what GTL is capable of. But with the tools to see how a graph can be broken down into different pieces and then combined together to create the final output, can make a task that may at one time seem impossible, possible. Layouts Single cell References Multi-cell “Graph Template Language Tip Sheet.” https://support.sas.com/rnd/app/ODSGraphics/TipSheet_GTL.pdf “Graph Template Modification Tip Sheet.” https://support.sas.com/rnd/app/ODSGraphics/TipSheet_GraphTemplateModification.pdf “SAS® 9.4 Graph Template Language: Reference, Fifth Edition.” http://support.sas.com/documentation/cdl/en/grstatgraph/69718/HTML/default/viewer.htm#p1rdkldsdjjotln1v88o3rdglyb7.htm “SAS® 9.4 Graph Template Language: User’s Guide, Fifth Edition.” http://documentation.sas.com/?docsetId=grstatug&docsetTarget=titlepage.htm&docsetVersion=9.4&locale=en Matange, Sanjay. Getting Started with the Graph Template Language in SAS®, SAS Institute (SAS Press, 2013). Layout Syntax 2-Step Process Single-Cell Example Contact Information Kriss Harris SAS Specialists Limited italjet125@yahoo.com http://www.krissharris.co.uk/ Richann Watson DataRich Consulting richann.watson@datarichconsulting.com http://www.datarichconsulting.com/ Multi-Cell Example Conclusions Click Headings Above to View Content
Single Cell Layout Examples Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Single Cell Layout Examples Return to Single Cell Layout
Multi-cell Layout Examples Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Multi-cell Layout Examples Return to Multi-Cell Layout More Multi-Cell Examples
Multi-cell Layout Examples Great Time to Learn GTL Kriss Harris, SAS Specialists Limited; Richann Watson, DataRich Consulting Multi-cell Layout Examples Return to Multi-Cell Layout