Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker.

Slides:



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

Use Tables for Layout Control Day 7. You will learn to: Understand Tables Create a Simple Table Modify Your Tables Appearance Create Page Layouts with.
Chapter 3 – Web Design Tables & Page Layout

KompoZer. This is what KompoZer will look like with a blank document open. As you can see, there are a lot of icons for beginning users. But don't be.
Describing Quantitative Variables
Using ODS Regions to Create Custom Reports Kate Morrow, M.S. Statistician Vermont Oxford Network, Burlington, VT.
DAY 8: MICROSOFT EXCEL – CHAPTER 5 Aliya Farheen February 5, 2015.
Simple Logistic Regression
Creating a Document with a Table, Chart, and Watermark
CREATING A MULTIPLE PAGE REPORT Presented by: Dr. Ennis-Cole.
Multiple Linear Regression
Excel Charts – Basic Skills Creating Charts in Excel.
Tutorial 4: Designing a Web Page with Tables
Statistics: Data Analysis and Presentation Fr Clinic II.
Creating a Web Page with Tables. Objectives Create a text table with preformatted text Create the basic structure of a graphical table Organize table.
Web Page Development Identify elements of a Web Page Start Notepad
XP Creating Web Pages with HTML Using Tables. XP Objectives Create a text table Create a table using the,, and tags Create table headers and captions.
Statistics: Data Presentation & Analysis Fr Clinic I.
Assumption of Homoscedasticity
Using Charts in a Presentation Lesson 6. Software Orientation Charts can help your audience understand relationships among numerical values. The figure.
NU Data Excel Orientation Graphing of Screening Data and Basic Graphing Functions.
Graphing in Excel X-Y Scatter Plot SCI 110 CCC Skills Training.
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.
A table is an arrangement of data (words and numbers) in rows and columns. Tables range in complexity from those with only two columns and a title to.
Word Processing ADE100- Computer Literacy Lecture 13.
SAS Lecture 5 – Some regression procedures Aidan McDermott, April 25, 2005.
Charts and Graphs V
Inference for regression - Simple linear regression
Introduction to SAS Essentials Mastering SAS for Data Analytics
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
CO1552 – Web Application Development Lists, Special Characters, and Tables.
PLOTS AND FIGURES DAVID COOPER SUMMER Plots One of the primary uses for MATLAB is to be able to create publication quality figures from you data.
Header (unit) 1) Vertical. Your data table should have columns at the top and the data should be underneath the columns. The data table should not be horizontal.
1 1 Slide © 2004 Thomson/South-Western Slides Prepared by JOHN S. LOUCKS St. Edward’s University Slides Prepared by JOHN S. LOUCKS St. Edward’s University.
Chapter 9 Creating and Designing Graphs. Creating a Graph A graph is a diagram of data that shows relationship among a set of numbers. Data can be represented.
XP New Perspectives on Microsoft Word 2002 Tutorial 31 Microsoft Word 2002 Tutorial 3 – Creating a Multiple-Page Report.
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.
A Picture Is Worth A Thousand Words. DAY 7: EXCEL CHAPTER 4 Tazin Afrin September 10,
 Definition  Components  Advantages  Limitations Contents  Introduction Introduction  Inserting a Table Inserting a Table  Drawing a Table Drawing.
Introduction to SAS/Graph 9.2 Ken Barz Colorado Prevention Center 22Oct2009 Ken Barz Colorado Prevention Center.
Introduction to SPSS. Object of the class About the windows in SPSS The basics of managing data files The basic analysis in SPSS.
Advanced Stata Workshop FHSS Research Support Center.
Grade 8 Math Project Kate D. & Dannielle C.. Information needed to create the graph: The extremes The median Lower quartile Upper quartile Any outliers.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. a lesson approach Microsoft® Excel 2010 © 2011 The McGraw-Hill Companies,
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;
MASUG September 15, Agenda  Guest Introductions  John Boling – SAS inSchool  Tim Garton – Health Forecasts  Announcements  Tips & Tricks 
Microsoft® Excel Use the Chart Tools Design tab. 1 Use the Chart Tools Layout and Format tabs. 2 Create chart sheets and chart objects. 3 Edit.
1. Tables, Charts, and Graphs Microsoft Word & Excel 2003.
Data Analysis, Presentation, and Statistics
Effective Visuals Tables Graphs Charts Illustrations.
Displaying Data  Data: Categorical and Numerical  Dot Plots  Stem and Leaf Plots  Back-to-Back Stem and Leaf Plots  Grouped Frequency Tables  Histograms.
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.
Progress and Outcome Measures - Part 3 Progress and Outcome Measures Part 3, Slide 1Copyright © 2004, Jim Schwab, University of Texas at Austin.
Chapter 8: Using Basic Statistical Procedures “33⅓% of the mice used in the experiment were cured by the test drug; 33⅓% of the test population were unaffected.
SAS/GRAPH The Basics. Today’s Topics GOPTIONS GPLOT GCHART GCONTOUR G3D.
`. Lecture Overview HTML Body Elements Linking techniques HyperText references Linking images Linking to locations on a page Linking to a fragment on.
BMTRY 789 Lecture9: Proc Tabulate Readings – Chapter 11 & Selected SUGI Reading Lab Problems , 11.2 Homework Due Next Week– HW6.
Graphical Presentation Dr. Amjad El-Shanti MD, PMH,Dr PH University of Palestine 2016.
VBk Practical Mathematics and Microsoft Excel Course Line graphs WINCHESTER COLLEGE.
(Unit 6) Formulas and Definitions:. Association. A connection between data values.
Irwin/McGraw-Hill © Andrew F. Siegel, 1997 and l Chapter 9 l Simple Linear Regression 9.1 Simple Linear Regression 9.2 Scatter Diagram 9.3 Graphical.
Chapter 6 Continuous Random Variables Copyright © 2014 by The McGraw-Hill Companies, Inc. All rights reserved.McGraw-Hill/Irwin.
QM222 A1 Visualizing data using Excel graphs
Signature: Microsoft Word 2003
Tutorial 3 – Creating a Multiple-Page Report
Building Worksheet Charts
Computing for Research I 01/26/2011 N. Baker
Section 6.2 Prediction.
Header (unit) 1) Vertical. Your data table should have columns at the top and the data should be underneath the columns. The data table should not be.
Presentation transcript:

Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker

Introduction to SAS/GRAPH SAS/GRAPH is the primary graphics component of SAS system. Includes charts, plots, and maps in both 2 and 3 dimensions. Procedures included GCHART, GPLOT, GMAP, GCONTOUR etc… We will focus on PROC GPLOT

Examples What Can Be Done using SAS GRAPH

What can be done with SAS/GRAPH? These samples courtesy of Robert Allison

What can be done with SAS/GRAPH? These samples courtesy of Robert Allison

What can be done with SAS/GRAPH? These samples courtesy of Robert Allison

What can be done with SAS/GRAPH? These samples courtesy of Robert Allison

Introduction Elements of SAS/GRAPH

Elements of SAS/GRAPH Overview Taken from SAS 9.2 documentation ODS Destination Elements Global Statements Procedure Step

Elements of SAS/GRAPH PROC GPLOT: Specifying an input data set Similar to all other SAS PROC’s –Proc gplot data=. ; Options include setting annotate data sets, image mapping for drill-down plots in web applications, Creating Uniform axis across plots, and specifying SAS catalog for placement of output.

Elements of SAS/GRAPH PROC GPLOT: Specifying an input data set Similar to all other SAS PROC’s –Proc gplot data=. ; Options include setting annotate data sets, image mapping for drill-down plots in web applications, Creating Uniform axis across plots, and specifying SAS catalog for placement of output.

Elements of SAS/GRAPH PROC GPLOT: Plotting You can use up to 2 plots statements at a time, however, at least one Plot statement is required. The plot statement is used to control the axis, plotting points, labels, tick marks, and the plot legend. The only required arguments are… –Plot * / ;

Elements of SAS/GRAPH PROC GPLOT: Plotting Options Options for plotting –Plot options Legend= or nolegend: specifies figure legend options Overlay: allows overlay of more than one Y variable Skipmiss: breaks the plotting line where Y values are missing –Appearance option Axis: Specifies axis label and value options Symbol: Specified symbol options href, vref: Draws vertical or horizontal reference lines on plot frame/fr or noframe/nofr: specifies whether or not to frame the plot caxis/ca, cframe/cfr, chref/ch, cvref/cv, ctext/c: specifies colors used for axis, frame, text or reference lines.

Introduction to SAS/GRAPH We will begin with rather simple code and let SAS decide how our graph will look. Then we will step through a few options that allow us to control and adjust the graphic output.

Examples 2 Variable Plotting / Scatter plots

Examples 2 Variables Suppose subjects are given a doses of experimental medication based on body weight over a 24 hour period (mg/24hrs). Variable X On the following day, each subject had their Vascular Cell Adhesion Molecule (μg/ml) levels measured. Variable Y1 The investigators are interested in seeing a plot of the dose given vs. the plasma VCAM levels to see if there may be an effect of the drug dose.

Examples 2 Variables Very basic plot, below we get all of the default options. Not very exciting. Definitely not publication quality.

Examples 2 Variables Very basic plot, below we get all of the default options. Not very exciting. Definitely not publication quality. Cannot read axis marks Axis labels don’t describe the data Crowded Axis

Examples 2 Variables: AXIS Statements AXIS ; –Label Option; Angle/a=degrees (0-359) Color/c=text color Font/f=font Height/h=text height (default=1) Justify=(left/center/right) Label=“text string” –Options precede label axis1 label=(a=90 c=black f=“arial” h=1.2 “time” a=90 c=black f=“arial” h=1.0 “hours”);

Examples 2 Variables: AXIS Statements AXIS ; –Order Option Order=(a to b by c): major tick marks will show up at intervals based on c. –Example order=(0 to 3 by 1); –Value Option value=(“” “” “”): applies text label to each major tick. –Example Value=( “Start” “Middle” “End”)

Examples 2 Variables: AXIS Statements Resets previous options Horizontal axis (X Variable) Vertical axis (Y Variable) Call Axis statements NOTE: you can also place the AXIS statements within the gplot proc

Examples 2 Variables: AXIS Statements The LABEL options helped make the axis labels meaningful, but the axis tick marks remain crowded

Examples 2 Variables: AXIS Statement Added ORDER option to Axis statement

Examples 2 Variables: AXIS Statement The axis are less crowded, but still very hard to read, using the Value= option will help.

Examples 2 Variables: AXIS Statement Added VALUE option to Axis statement

Examples 2 Variables Now about those data points!

Examples 2 Variables: Symbol Statement Symbol ; –Symbol options Color= value color Ci=line color Height=symbol height Line=line type Value=symbol Width=thickness factor Interpol=point interpolations

Examples 2 Variables: Symbol Statement Symbol ; –Symbol options Interpolation options –Join, box, hilo interpolation, regression, spline, standard deviations. value options –Dot, circle, star, square, plus, minus, “text value”. Color options –256 colors available,256 colors available,

Examples 2 Variables: Symbol Statement Symbol options Interpolation options –None –Join: points connected by straight line –Needle: vertical line from horizontal axis to point –Stepx: (L,R,C) step function, stepxJ will add a verticle line to each step plot –stdkxxx: (M,P,J,B,T) k=1,2,3 (standard deviations) or »stdM=SEM, stdp=uses pooled sample variance, stdj=joins the errors, T will give tops and bottoms to error lines, where B will request error bars. –HILOxxx: (T,B,C,J)

Examples 2 Variables: Symbol Statement Symbol options Interpolation options –R-series interpolation –Rxxxxxxx »RL: linear regression »RQ: Quadratic Regression »RC: Cubic Regression » CLM: CI for mean predicted values » CLI: CI for Individual predicted values » 90, 95, 99: confidence limits »Example: RLCLM95 -> Gives a linear regression line with the 95% CL for mean predicted values

Examples 2 Variables: SYMBOL Statement

Examples 2 Variables: Adding Regression Lines

Examples Grouping Variables Many times we want to look at group differences. Demographic groups, treatment groups, etc… Grouping variable must be in the data file.

Examples Grouping Variables You need to add a new SYMBOL statement for the each additional group. Add the grouping variable to the PLOT statement

Examples Grouping Variables Not bad, but the default figure legend is not well placed.

Examples Grouping Variables: Legend Statement Legend ; –Legend options Across=: number of columns Down=: number of rows Frame/noframe Position=(bottom, middle, top) (left, center, right) (inside, outside) Origin=(x,y) Label= Order= Value= These options are the same as within the axis statement discussed earlier

Examples Grouping Variables: Legend Statement Legend Statement Call Legend Statement

Examples Grouping Variables: Legend Statement

Examples Repeated Measures/Longitudinal Plotting

Suppose that you have many observations on each subject taken at various time points. 40 subjects 2 treatments (Placebo and Active med) 5 time points (baseline plus 4 1-week intervals) –During the last week, both treatment groups receive Placebo Data should be in the Long format At diagnosis, subjects are randomized to an experimental treatment or placebo. During the final week of treatment, all subjects will receive active medication.

Examples Repeated Measures/Longitudinal Plotting Create appropriate axis and legend statements as before. AXIS for X (time) variable AXIS for Y (Response) variable Added TITLE statement for plot

Examples Repeated Measures/Longitudinal Plotting

Joins the dots, By ID

Examples Repeated Measures/Longitudinal Plotting Plot data by trt group and create a symbol statement for each group

Examples Using the Overlay statement to stack plots

Examples Overlay 2 plots w/ the same data Suppose that you are asked to graphically show progression of tumor growth for a group of subjects and overlay the progression of each treatment group. 50 subjects randomized to either low or high dose medication. Tumor size is measured at baseline as well as the following 9 weeks. The investigator would like an easy to present plot containing both pieces of information for a presentation to his peers.

Examples Overlay 2 plots w/ the same data Plot of individual values as before Plot of treatment group means and Standard errors as before Grouping variable Symbol repeats

Examples Overlay 2 plots w/ the same data

Examples Overlay multiple plots from different variables Use proc logistic to output the predicted probability of developing nephropathy given the baseline Oxidized LDL immune complex level as well as the 95% confidence limits. Many PROCs can output predicted values, adjusted means, along with point wise confidence values.

Examples Overlay multiple plots from different variables

The Annotate Facility

The Annotate Facility Introduction The Annotate Facility allows SAS users to customize graphical output. The customizations can be data driven or user specified. Text, shapes, lines and images can be added to output graphics Step 1. Create an annotate data set This data file will give commands to SAS/GRAPH Specific variables must be in the annotate data set. Others are allowed but ignored. What, how, and where are defined by these variables. Table 1 list important variables. Step 2. Call the annotate data file in the PROC GPLOT statement. Proc Gplot data=data anno=myanno; …

The Annotate Facility Introduction

The Annotate FUNCTION variable tells SAS what to do The annotate coordinate system allows for flexibility in placing objects within the output. There are 12 possible conditions.

The Annotate Facility Introduction

The Annotate Facility Proc GPLOT global options help make graphs more pleasing, however, there are cases where more work is needed to fully explain the data

The Annotate Facility Created shaded regions to designate study sections Deleted regions of non interest Added treatment group and study section labels

The Annotate Facility Tells SAS when to do action: A=after, B=before Indicate which coordinate system to use: 2=absolute values (hsys is used for the size of objects)

The Annotate Facility BORING! Suppose you want To jazz up your plots for a Presentation. You can place a picture Or graphic behind you data to accent The results. We are going to place an image behind the data, but only where The values are less than the data points. NEAT!

The Annotate Facility Anno data set 1: Will place the image of the dollar over the plotting area. Anno data set 2: Will create white Space above the Plotted line over time. SET the anno data sets and call them in the GPLOT statement When=‘b’ places the image behind the plot. This places the entire image behind the plot This annotate file creates white space in the area above the data line

The Annotate Facility Zing!!!

The End