Download - Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker
![Page 1: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/1.jpg)
Statistical Graphics for the SAS System
Computing for Research I
01/29/2014
Nathaniel L Baker
![Page 2: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/2.jpg)
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
![Page 3: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/3.jpg)
ExamplesWhat Can Be Done using SAS GRAPH
![Page 4: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/4.jpg)
What can be done with SAS/GRAPH?
These samples courtesy of Robert Allison
![Page 5: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/5.jpg)
What can be done with SAS/GRAPH?
These samples courtesy of Robert Allison
![Page 6: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/6.jpg)
What can be done with SAS/GRAPH?
These samples courtesy of Robert Allison
![Page 7: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/7.jpg)
What can be done with SAS/GRAPH?
These samples courtesy of Robert Allison
![Page 8: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/8.jpg)
IntroductionElements of SAS/GRAPH
![Page 9: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/9.jpg)
Elements of SAS/GRAPHOverview
Taken from SAS 9.2 documentation
ODS
Destination
Elements
Global Statements
Procedure Step
![Page 10: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/10.jpg)
Elements of SAS/GRAPHPROC GPLOT: Specifying an input data set
Similar to all other SAS PROC’s– Proc gplot data=<libname>.<data set><options>;
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.
![Page 11: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/11.jpg)
Elements of SAS/GRAPHPROC GPLOT: Specifying an input data set
Similar to all other SAS PROC’s– Proc gplot data=<libname>.<data set><options>;
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.
![Page 12: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/12.jpg)
Elements of SAS/GRAPHPROC 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 <Y Variable>*<X Variable> / <options>;
![Page 13: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/13.jpg)
Elements of SAS/GRAPHPROC 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.
![Page 14: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/14.jpg)
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.
![Page 15: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/15.jpg)
Examples2 Variable Plotting / Scatter plots
![Page 16: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/16.jpg)
Examples2 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.
![Page 17: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/17.jpg)
Examples2 Variables
y1
0
1
2
3
x
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9
Very basic plot, below we get all of the default options. Not very exciting. Definitely not publication quality.
![Page 18: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/18.jpg)
Examples2 Variables
y1
0
1
2
3
x
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9
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
![Page 19: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/19.jpg)
Examples 2 Variables: AXIS Statements
• AXIS<1..99> <options>;– 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”);
![Page 20: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/20.jpg)
Examples2 Variables: AXIS Statements
• AXIS<1..99> <options>;– 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”)
![Page 21: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/21.jpg)
Examples2 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
![Page 22: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/22.jpg)
Examples2 Variables: AXIS Statements
Pla
sm
a L
ev
el
0
1
2
3
Dosemg/24 Hrs
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9
The LABEL options helped make the axis labels meaningful, but the axis tick marks remain crowded
![Page 23: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/23.jpg)
Examples2 Variables: AXIS Statement
Added ORDER
option to Axis statement
![Page 24: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/24.jpg)
Examples2 Variables: AXIS Statement
Pla
sm
a L
evel
0
1
2
3
Dosemg/24 Hrs
0.0 0.5 1.0 1.5 2.0
The axis are less crowded, but still very hard to read, using the Value= option will help.
![Page 25: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/25.jpg)
Examples2 Variables: AXIS Statement
Added VALUE option to Axis
statement
![Page 26: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/26.jpg)
Examples2 Variables
Pla
sm
a L
ev
el
0.0
1.0
2.0
3.0
Dosemg/24 Hrs
0.0 0.5 1.0 1.5 2.0
Now about those data points!
![Page 27: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/27.jpg)
Examples2 Variables: Symbol Statement
• Symbol<1…255> <options>;– Symbol options
• Color= value color• Ci=line color• Height=symbol height• Line=line type• Value=symbol• Width=thickness factor• Interpol=point interpolations
![Page 28: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/28.jpg)
Examples2 Variables: Symbol Statement
• Symbol<1…255> <options>;– 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,
www.devenezia.com/docs/SAS/sas-colors.html
![Page 29: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/29.jpg)
Examples2 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)
![Page 30: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/30.jpg)
Examples2 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
![Page 31: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/31.jpg)
Examples2 Variables: SYMBOL Statement
Pla
sm
a L
ev
el
0.0
1.0
2.0
3.0
Dosemg/24 Hrs
0.0 0.5 1.0 1.5 2.0
![Page 32: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/32.jpg)
Examples2 Variables: Adding Regression Lines
Pla
sm
a L
evel
0.0
1.0
2.0
3.0
Dosemg/24 Hrs
0.0 0.5 1.0 1.5 2.0
Regression Equation: y1 = 0.481173 + 1.269433*x
![Page 33: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/33.jpg)
ExamplesGrouping Variables
• Many times we want to look at group differences.
• Demographic groups, treatment groups, etc…
• Grouping variable must be in the data file.
![Page 34: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/34.jpg)
ExamplesGrouping Variables
You need to add a new SYMBOL statement for the each additional group.
Add the grouping variable to the PLOT statement
![Page 35: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/35.jpg)
ExamplesGrouping Variables
Pla
sm
a L
evel
0.0
1.0
2.0
3.0
Dosemg/24 Hrs
0.0 0.5 1.0 1.5 2.0
gender Female Male
Not bad, but the default figure legend is not well placed.
![Page 36: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/36.jpg)
ExamplesGrouping Variables: Legend Statement
• Legend<1…99> <options>;– 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
![Page 37: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/37.jpg)
Examples Grouping Variables: Legend Statement
Legend Statement
Call Legend Statement
![Page 38: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/38.jpg)
Examples Grouping Variables: Legend Statement
Pla
sm
a L
ev
el
0.0
1.0
2.0
3.0
Dosemg/24 Hrs
0.0 0.5 1.0 1.5 2.0
Gender FemaleMale
![Page 39: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/39.jpg)
ExamplesRepeated Measures/Longitudinal Plotting
![Page 40: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/40.jpg)
ExamplesRepeated 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.
![Page 41: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/41.jpg)
ExamplesRepeated 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
![Page 42: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/42.jpg)
ExamplesRepeated Measures/Longitudinal Plotting
Re
sp
on
se
0
10
20
30
40
50
60
70
80
90
100
Time Since Diagnosis: Weeks
Baseline 1 2 3 4
Individual Disease Progression
![Page 43: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/43.jpg)
ExamplesRepeated Measures/Longitudinal Plotting
Joins the dots,
By ID
Re
sp
on
se
0
10
20
30
40
50
60
70
80
90
100
Time Since Diagnosis: Weeks
Baseline 1 2 3 4
Individual Disease Progression
![Page 44: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/44.jpg)
ExamplesRepeated Measures/Longitudinal Plotting
Re
sp
on
se
0
10
20
30
40
50
60
70
80
90
100
Time Since Diagnosis: Weeks
Baseline 1 2 3 4
Individual Disease Progression
Treatment Group Treatmant A Placebo
Plot data by trt group and create a symbol statement for each group
![Page 45: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/45.jpg)
ExamplesUsing the Overlay statement to stack plots
![Page 46: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/46.jpg)
ExamplesOverlay 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.
![Page 47: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/47.jpg)
ExamplesOverlay 2 plots w/ the same data
Tu
mo
r G
row
th
0
10
20
30
40
50
60
70
80
Time Since Diagnosis: Weeks
Baseline 1 2 3 4 5 6 7 8 9
Individual Disease Progression
Tu
mo
r G
row
th
0
10
20
30
40
50
60
70
80
Time Since Diagnosis: Weeks
Baseline 1 2 3 4 5 6 7 8 9
Individual Disease Progression
Treatment Group Low Dose High Dose
Plot of individual values as before
Plot of treatment group means and Standard errors as before
Grouping variable Symbol repeats
![Page 48: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/48.jpg)
ExamplesOverlay 2 plots w/ the same data
![Page 49: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/49.jpg)
ExamplesOverlay 2 plots w/ the same data
Tu
mo
r G
row
th
0
10
20
30
40
50
60
70
80
Time Since Randomization: Weeks
Baseline 1 2 3 4 5 6 7 8 9
0
10
20
30
40
50
60
70
80
Individual Disease Progression
Treatment Group Low Dose High Dose
![Page 50: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/50.jpg)
ExamplesOverlay 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.
![Page 51: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/51.jpg)
ExamplesOverlay multiple plots from different variables
Pro
b.
of
Ne
ph
rop
ath
y (
95
% C
I)
0.0
0.2
0.4
0.6
0.8
Baseline Ox LDL-IC
1.80 2.14 2.48 2.82 3.16 3.50 3.84 4.18 4.52 4.86 5.20 5.54 5.88 6.22 6.56 6.90
![Page 52: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/52.jpg)
ExamplesOverlay multiple plots from different variables
![Page 53: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/53.jpg)
ExamplesOverlay multiple plots from different variables
Ba
se
lin
e L
DL
& H
DL
(m
g/d
l)
0
50
100
150
200
250
Baseline OxLDL-IC Quartile
1st 2nd 3rd 4th
Ba
se
line
Ox
LD
L-IC
0
100
200
300
400
500Baseline Characteristics OxLDL-IC LDL Cholesterol
HDL CholesterolBaseline Characteristics OxLDL-IC
![Page 54: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/54.jpg)
The Annotate Facility
![Page 55: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/55.jpg)
The Annotate FacilityIntroduction
The Annotate Facility allows SAS users to customize graphicaloutput. 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 setThis 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;…
![Page 56: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/56.jpg)
The Annotate FacilityIntroduction
![Page 57: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/57.jpg)
The Annotate FacilityIntroduction
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.
![Page 58: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/58.jpg)
The Annotate FacilityIntroduction
![Page 59: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/59.jpg)
The Annotate FacilityIntroduction
![Page 60: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/60.jpg)
The Annotate FacilityH
bA
1c
6.0 %
6.5 %
7.0 %
7.5 %
8.0 %
8.5 %
9.0 %
9.5 %
10.0 %
Study TimeYears
BL 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9
Mean HbA1c % durring DCCT/EDIC study
Proc GPLOT global options help make graphs more pleasing, however, there are cases where more work is needed to fully explain the data
![Page 61: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/61.jpg)
The Annotate Facility
Created shaded regions to designate study sections
Deleted regions of non interest
Added treatment group and study section labels
![Page 62: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/62.jpg)
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)
![Page 63: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/63.jpg)
The Annotate Facility
$ 0.00
$ 0.10
$ 0.20
$ 0.30
$ 0.40
$ 0.50
$ 0.60
$ 0.70
$ 0.80
$ 0.90
$ 1.00
Year
Jan. 2007 Jan. 2008 Jan. 2009 Jan. 2010 Jan. 2011
Individual Net WorthAs a Function of Original Worth
BORING!Suppose you want To jazz up your plots for a Presentation. You can place a pictureOr 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!
![Page 64: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/64.jpg)
The Annotate Facility
Anno data set 1:Will place the image of the dollar over the plotting area.
Anno data set 2:Will create whiteSpace 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
![Page 65: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/65.jpg)
The Annotate Facility
$ 0.00
$ 0.10
$ 0.20
$ 0.30
$ 0.40
$ 0.50
$ 0.60
$ 0.70
$ 0.80
$ 0.90
$ 1.00
Year
Jan. 2007 Jan. 2008 Jan. 2009 Jan. 2010 Jan. 2011
Individual Net WorthAs a Function of Original Worth
Zing!!!
![Page 66: Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker](https://reader033.vdocuments.us/reader033/viewer/2022051621/56649f385503460f94c55014/html5/thumbnails/66.jpg)
The End