Effective SAS greplay’ing and how to avoid stretching By David Mottershead Senior Programmer, Quanticate.

Slides:



Advertisements
Similar presentations
Summary Statistics/Simple Graphs in SAS/EXCEL/JMP.
Advertisements

Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
Using ODS Regions to Create Custom Reports Kate Morrow, M.S. Statistician Vermont Oxford Network, Burlington, VT.
Jeopardy Multiple Choice Fill in the Blank Modified T/F Vocabulary Positioning of data Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400.
® Microsoft Office 2010 Excel Tutorial 2: Formatting a Workbook.
McGraw-Hill Career Education© 2008 by the McGraw-Hill Companies, Inc. All Rights Reserved. Office PowerPoint 2007 Lab 1 Creating a Presentation.
By Hrishikesh Gadre Session II Department of Mechanical Engineering Louisiana State University Engineering Equation Solver Tutorials.
TITLE: Template for a 84.1 cm wide x cm tall poster (A0)
Graphics - setCoords. The coordinate system of Zelle graphics The default coordinate system for GraphWin is that the origin is in the upper left hand.
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 12 Spreadsheets and Business Graphics: Facts and Figures.
Introduction to SPSS Short Courses Last created (Feb, 2008) Kentaka Aruga.
About this template This template was designed to produce a 48x36 poster. You can modify it as needed for your presentation. By using this.
Example layout for an A1 poster presentation
The gchart Procedure The gchart Procedure is used to create bar charts of various types (it can also create pie charts. It’s most basic form would look.
CHAPTER 11 Tables. How Are Tables Used Data Display  Very tidy and very useful Better Text Alignment  Putting text in tables allows you to format indents.
11 Chapter 3: Getting Started with Tasks 3.1 Introduction to Tasks and Wizards 3.2 Creating a Frequency Report 3.3 Generating HTML, PDF, and RTF Output.
Dashboards With PROC GKPI September 25, 2009 Barry Hong
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
Project title to go here Introduction The page size of the poster is to be A1 (59.4cm x 84.1 cm) and it is to be produced in portrait (vertical) format.
Computers: Tools for an Information Age Chapter 12 Spreadsheets and Business Graphics: Facts and Figures.
PROC GREPLAY With Templates December 5, 2008 Barry Hong Process Analysis and Simulation U. S. Steel Canada © 2008 United States Steel Corporation.
Tips & Tricks MASUG02/18/2005. Multiple Graphs on One Page.
TS02 SAS GTL - Injecting New Life into Graphs
Lesson 8 — Spreadsheets Unit 2 — Software. Lesson 8 – Spreadsheets 2 Objectives Understand the purpose and function of a spreadsheet. Identify the major.
Poster title goes here, sentence case, key words designed to attract the right audience Author’s name here, Author’s name here, Author’s name here Address.
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
Demographic Profiles of Agency Clients - Part 2 Next, we will create a table and a column chart for the conservator field in my database. Because we are.
Designing a Web Page with Tables. A text table: contains only text, evenly spaced on the Web page in rows and columns uses only standard word processing.
Introduction to SAS/Graph 9.2 Ken Barz Colorado Prevention Center 22Oct2009 Ken Barz Colorado Prevention Center.
Computer Information Technology – Section 4-12 Some text and examples used with permission from: Note: We not endorsing or promoting.
EXAM REVIEW PROJECT Microsoft Excel Exam 1. EXAM PROCEDURES 10 minutes to review project before starting 60 minutes to complete the exam In this presentation,
Introduction to SPSS. Object of the class About the windows in SPSS The basics of managing data files The basic analysis in SPSS.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall. 1 Skills for Success with Microsoft ® Office 2007 PowerPoint Lecture to Accompany.
1 EPIB 698E Lecture 1 Notes Instructor: Raul Cruz 7/9/13.
Return to Outline Copyright © 2011 by Maribeth H. Price 3-1 Labeling and annotation.
ON PATHS LESS TRODDEN… Excursions in SAS/GRAPH ® and PROC TABULATE Presented by Aaron Rabushka © Aaron Rabushka 2000.
Fall 2003Sylnovie Merchant, Ph.D. ACCESS Tutorial Note: The purpose of this tutorial is to provide an introduction to some of the functions of ACCESS in.
PROC GPLOT GPLOT is used to make two dimensional scatter-plots. General Syntax: proc gplot data=data-set options; plot y-variable*x-variable/options; run;
TEMPLATE DESIGN © Professional Template for a 24x36 poster presentation Your name and the names of the people who have.
MASUG September 15, Agenda  Guest Introductions  John Boling – SAS inSchool  Tim Garton – Health Forecasts  Announcements  Tips & Tricks 
Abadan Faculty of Petroleum Engineering Petroleum University of Technology Petroleum University of Technology │ About this template This.
Introducing Dreamweaver. Dreamweaver The web development application used to create web pages Part of the Adobe creative suite.
SAS ® is a very powerful tool when producing Graphics. A single graphical data step can easily create a Kaplan Meier Plot, but there is no single graphical.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
SAS/GRAPH The Basics. Today’s Topics GOPTIONS GPLOT GCHART GCONTOUR G3D.
SAS Beyond TFLs: An Application as a Statistician’s Tool William Coar Date: 10/15/2009 Denver SAS User’s Group.
PROC CATALOG The Wish Book SAS® Procedure. 2 PROC CATALOG, the Wish Book SAS® Procedure Louise S. Hadden Abt Associates Inc. PROC CATALOG, the Wish Book.
1 EPIB 698C Lecture 1 Instructor: Raul Cruz-Cano
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Illustrator lecture 1: how to use Adobe Illustrator with raster maps? Yhd Water and people.
Behind the Scenes with SAS®: Using Customer Graphics in SAS® Output Louise Hadden Abt Associates Inc.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
TEMPLATE DESIGN © Professional Template for a 36x48 poster presentation Your name and the names of the people who have.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
Author’s Name/s Goes Here1, Author’s Name/s Goes Here2
By Dr. Madhukar H. Dalvi Nagindas Khandwala college
DEPARTMENT OF COMPUTER SCIENCE
Chapter 8: ODS Graphics ODS graphics were not available prior to SAS 9.2 They have been implemented across a wide range of procedures Functionality isn’t.
Microsoft Word: Tables
Professional Template for a 36x48 poster presentation
ON PATHS LESS TRODDEN… Excursions in SAS/GRAPH® PROC TABULATE and
Illustration in Scientific Writing
Author’s Name/s Goes Here1, Author’s Name/s Goes Here2
Author’s Name/s Goes Here1, Author’s Name/s Goes Here2
Glassy–Winged Sharpshooter: Farmer’s Scourge
Professional Template for a 36x48 poster presentation
Professional Template for a 36x48 poster presentation
Lesson 5: HTML Tables.
Professional Template for a 80(width) x 100(height) cm2 poster presentation Your name and the names of the people who have contributed to this presentation.
Presentation transcript:

Effective SAS greplay’ing and how to avoid stretching By David Mottershead Senior Programmer, Quanticate

Introduction Review goptions Look at how text size is affected when goptions are changed Creating figures with proc gplot Creating titles and footnotes using proc gslide Creating a template with proc greplay Creating a figure with proc greplay

Introduction greplay stretching – the problem!

Introduction greplay stretching – what we want

Diagram of figure 50pct 100pct 80pct 10pct Titles Footnotes Gplot 1Gplot 2

SAS goptions Goptions are used to control how graphical output is displayed. There are some key goptions which are used to control the size of figures: – Xmax: specifies the width of the figure – Ymax: specifies the height of the figure – Xpixels: specifies the number of pixels for the width of the figure – Ypixels: specifies the number of pixels for the height of the figure

SAS goptions (cont.) The required width of the combined figure is 24.5cm and the required height is 14.5cm. So the width and height of the gplot figures are calculated as follows: – The width of gplot figures = 0.5 * 24.5cm = 12.25cm. – The height of gplot figures = 0.8 * 14.5cm = 11.6cm. The goptions to define the dimensions of the combined figure and the gplot figures are shown below: ** Combined figure **; ** Individual gplots **; goptions xmax = 24.5cm goptions xmax = 12.25cm xpixels = 2450 xpixels = 1225 ymax = 14.5cm ymax = 11.6cm ypixels = 1450; ypixels = 1160;

SAS goptions (cont.) There are other important goptions which are required throughout the whole of the session: goptions device = emf htext = 0.35cm ftext = simplex; Device - specifies the graphics device. Htext - specifies the text height. Ftext – specifies the font.

How is text size affected when the ymax goption is changed? The size of SAS text is controlled by specifying its height in units. The default SAS unit for specifying text height is cells. An important property of the cell unit is that heights are in relation to the height of the figure (ymax). In our example, if a text size of 1 cell is used to create both the gslide and gplot figures, the size of the text in the gplot figures will be 80 percent of the size of the text in the gslide. The easiest way to avoid this is to use an absolute unit such as cm or in.

How is text size affected when the ymax goption is changed? (cont.) Alternatively you can calculate the required text size in cells for the gplot figures so the text size will be 1 cell in the combined figure. Since the height of the gplot figures are 80 percent of the gslide, 1 ÷ 0.8 = 1.25.

Creating figures with proc gplot The SAS/GRAPH procedure proc gplot has been used to create the figures. Some additional options have been used to enhance the look of the gplots: – Minor tick marks removed. – Symbol statements are used to define symbols, symbol colours and specify interpolation lines. – Axis statements are used to rotate the orientation of the vertical axis label so it is vertical, specify offsets for the axis so that symbols fit within the graph area and to reduce the height of the axis slightly so the full figure will display correctly using the length option.

Creating figures with proc gplot (cont.) – A legend statement is used to place the legend within the graph area, which creates more space for the plot. The shape of the legend has also been manipulated so only one symbol is displayed next to the legend label rather than three. It is worth noting that SAS has a problem of correctly calculating the required length of the vertical axis for the graph to fit within the defined area. When this occurs the following warning is printed to the log: – WARNING: The left vertical axis labeled Height was too large as specified. Specify LENGTH=XX.X PERCENT. This can be corrected by specifying the length of the axis to be less than or equal to the length specified.

SAS catalogs and figure names By default – the figure will be stored in a catalogue called gseg in the work directory. – the name of the first figure created by the gplot procedure will be gplot. The next figure created will be gplot1, then gplot2 and so on. You can specify the name of the SAS catalogue to store the figure in using the gout= option in the gplot statement. You can change the name of the figure using the name= option in the plot statement to a name of your choice up to 8 characters.

SAS catalogs and figure names If a figure with the same name already exists within the catalogue it will not be overwritten but incremented with a 1 at the end, then a two at the end and so on. When developing code in SAS interactively it is worth being aware of this when changing gplot code and re-running a greplay procedure again because if the old figures are not deleted from the catalogue the new versions of the gplot figures will not be used in the greplay. The contents of the catalogue can be deleted using the following code. proc datasets lib=work nolist memtype=cat; delete ; quit;

Creating titles and footnotes using proc gslide Titles and footnotes should be presented consistently with the titles and footnotes in accompanying listings and tables. They also need to span across the whole of the graph area. A simple way to do this is using the SAS/GRAPH procedure proc gslide. proc gslide; title1 j=l "PhUSE 2011"; title2 j=l "Figure 1"; title3 j=l "Plot of height against age and weight against age"; footnote1 j=l "Author: David Mottershead"; run; quit;

Using the greplay procedure to create a template The syntax to set up our template is as follows: proc greplay tc=work.tempcat nofs; tdef newtemp des='Two panel template‘ The tc= option defines the template catalogue where the template will be stored. The nofs option stops windows being used in interactive SAS. The tdef statement is used to define the new template which is called newtemp in our example. The description option associates a description with the template.

Using the greplay procedure to create a template (cont.) The template is created by defining the coordinates of the 4 corners where each figure will be placed. The coordinates of the whole greplay area are shown in the below figure. (0,0) Lower Left (100,0) Lower Right x y Upper Left (0,100) Upper Right (100,100)

Using the greplay procedure to create a template (cont.) A visualisation and the code to create the template for the gslide (1) and gplot figures 1 and 2 (2 and 3 respectively) are shown below: 1/llx=0 lly=0 lrx=100 lry=0 ulx=0 uly=100 urx=100 ury=100 2/llx=0 lly=10 lrx=50 lry=10 ulx=0 uly=90 urx=50 ury=90 3/llx=50 lly=10 lrx=100 lry=10 ulx=50 uly=90 urx=100 ury=90 (50,10) (50,90) (100,90) (100,10) (0,90) (0,10) Upper Left (0,100) Upper Right (100,100) (0,0) Lower Left (100,0) Lower Right x y

Using the greplay procedure to create the final figure We need to set up the filename and goptions to save our figure to an external location. Example code is shown below. filename gsasfile "C:\temp\Combined Figure.emf"; goptions gsfname = gsasfile gsfmode = replace; The filename statement specifies where the figure will be stored. The goption gsfname associates the filename with the figure. The option gsfmode = replace is used so each time a figure is created it will be replace by the new one.

Using the greplay procedure to create the final figure (cont.) We use proc greplay again and specify the same template catalogue and nofs options. The template statement is used to specify the name of the template we want to use. The igout statement specifies the catalogue where we want the created figure to be stored. The treplay statement is used to specify figures from the catalogue which we want to place into the different template positions. proc greplay tc=work.tempcat nofs; template newtemp; igout work.tempcat; treplay 1:GSLIDE 2:FIGURE1 3:FIGURE2; run; quit;

Using the greplay procedure to create the final figure (cont.)

Summary Review goptions Look at how text size is affected when goptions are changed Creating figures with proc gplot Creating titles and footnotes using proc gslide Creating a template with proc greplay Creating a figure with proc greplay

“…creating one page of output with multiple graphs … can be very tedious.” “…graphs are scaled down to fit in the cookie cutter sections of the template. The scaling of the graphs can result in illegible fonts and problems with the lengths of the axis.” – Dirk Spruck.

End. Questions?