controlling sas graphics using annotate datasets l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Controlling SAS Graphics using ANNOTATE Datasets PowerPoint Presentation
Download Presentation
Controlling SAS Graphics using ANNOTATE Datasets

Loading in 2 Seconds...

play fullscreen
1 / 22

Controlling SAS Graphics using ANNOTATE Datasets - PowerPoint PPT Presentation


  • 308 Views
  • Uploaded on

Controlling SAS Graphics using ANNOTATE Datasets. Elizabeth Campagna University of Colorado Denver Colorado Health Outcomes Program. Colorado Day – Denver SAS Users Group, September 25 2008. Outline. Why use ANNOTATE How to use an ANNOTATE dataset What is an ANNOTATE dataset Examples

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Controlling SAS Graphics using ANNOTATE Datasets' - Mia_John


Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
controlling sas graphics using annotate datasets

Controlling SAS Graphics using ANNOTATE Datasets

Elizabeth Campagna

University of Colorado Denver

Colorado Health Outcomes Program

Colorado Day – Denver SAS Users Group, September 25 2008

outline
Outline
  • Why use ANNOTATE
  • How to use an ANNOTATE dataset
  • What is an ANNOTATE dataset
  • Examples
  • References
slide3
Why?
  • Enhancement and modification of graphical features - flexibility to add any drawing object or text, in any format or color, to any place on your graphical output
    • Position text labels in a graph
    • Create custom legends
    • Draw lines between points
    • Add symbols at specific locations
slide4
Create an ANNOTATE dataset

Execute the ANNOTATE commands by including the following option in your SAS/GRAPH code

SAS/GRAPH interprets and executes the drawing commands along with the graph and creates output that has both included

PROC GPLOT data=apple / ANNOTATE=<ANNOTATE file name>;

PLOT color*state;

RUN;

How?
slide5
Ordinary SAS dataset

Each observation is a drawing command defined by the values placed in each of the specific variables.

Variables are constricted in values/attributes they can have

Variables in an ANNOTATE dataset ALL information

What is to be done? FUNCTION

How is it to be done? COLOR, SIZE, STYLE, POSITION

Where is it to be done? X, Y, XSYS, YSYS

What?
slide6
What?

FUNCTION variable tells SAS what to do, the other variables all modify, specify, or locate the function.

. . .

attributes how
Attributes (how)

Attributes are RETAINED between functions unless re-defined

dimensions where
Dimensions (where)
  • X The numeric horizontal coordinate.
  • Y The numeric vertical coordinate.
  • Z For three-dimensional graphs, specifies the coordinate for the 3rd dimension.
  • XSYS The coordinate system for the X variable.
  • YSYS The coordinate system for the Y variable.
  • ZSYS The coordinate system for the Z variable (for three-dimensional graphs).
dimensions where10
Dimensions (where)

Example: XSYS=‘1’; YSYS=‘A’;

annotate macros
ANNOTATE MACROS
  • ANNOTATE macros within a SAS DATA step simplify the process of creating ANNOTATE observations.
  • Specify a function and assign variable values (attributes) in one step
  • You can mix assignment statements and macro calls in the same DATA step.
  • Execute: “%annomac;” to make ANNOTATE macros available
example
Example
  • How to draw lines, place symbols, & place text
  • Changing attributes
  • Illustrate the use of various coordinate systems
  • Use of ANNOTATE macros
sas code annotate
SAS Code - ANNOTATE

%annomac;

data anno;

length function color style $8 text $40;

xsys='2'; ysys='2'; size=1; line=1; color='black';

set test;

* plot Odds Ratios;

function='symbol'; style='none' ; text='dot'; x=mid; y=grp; output;

* add horizontal lines representing OR CI;

function='move'; x=low; y=grp; output;

function='draw'; x=up; y=grp; output;

* add vertical lines at end of CI;

%LINE (low, grp-0.05, low, grp+0.05, black, 1, 1);

%LINE (up, grp-0.05, up, grp+0.05, black, 1, 1);

* labels;

function='label'; style="'Arial'"; size=1.5; x=low; y=grp; position="3"; text=grplabels; output;

* use graphics output area for vertical positioning to set x-axis labels below data area;

ysys='3'; position="5";

function='label'; size=1.75; x=0.3; y=11; text="Decreased Likelihood"; output;

function='label'; x=3; text="Increased Likelihood"; output;

run;

slide16
* add horizontal lines representing OR CI;function='move'; x=low; y=grp; output;function='draw'; x=up; y=grp; output;
slide17
* add vertical lines at end of CI;%LINE (low, grp-0.05, low, grp+0.05, black, 1, 1); %LINE (up, grp-0.05, up, grp+0.05, black, 1, 1);
slide19

* use graphics output area for vertical positioning to set x-axis labels below data area;ysys='3'; position="5";function='label'; size=1.75; x=0.3; y=11; text="Decreased Likelihood"; output;function='label'; x=3; text="Increased Likelihood"; output;

sas code proc gplot
SAS Code – Proc GPLOT

goptions reset=all;

goptions cback=white ctext=black ftitle='Arial' ftext="Arial"

fby='Arial' htitle=2 htext=12 PT gsfname=plots device=gif xmax=6 IN ymax=4 IN;

axis1 logbase=10 logstyle=expand order=(0.1 1 10)

label=(font='Arial' height=12 PT justify=center '');

axis2 order=(0 to 4 by 1)

/* change max axis value as needed (# grps + 1) */ color=white;

symbol1 i=none;

title 'Odds Ratios w/95% CI';

footnote 'Denver SAS Users Group Colorado Day 2008';

filename plots "H:\misc\DSUG\2008\plot1.gif";

proc gplot data=test;

plot grp*up / anno=anno haxis=axis1 vaxis=axis2 href=1 noframe;

run; quit;

title; footnote;

references
References

Introduction to SAS/Graph

Michael Friendly

Statistical Consulting Service

http://www.psych.yorku.ca/lab/sas/sganno.htm

SUGI 31, Paper 085-31

Improving Your Graphics Using SAS/GRAPH® ANNOTATE Facility

David Mink, Ovation Research Group, San Francisco, CA

David J. Pasta, Ovation Research Group, San Francisco, CA

http://www2.sas.com/proceedings/sugi31/085-31.pdf

Data Driven Annotations:

An Introduction to SAS/GRAPH’s® ANNOTATE Facility

Arthur L. Carpenter

California Occidental Consultants

http://www.caloxy.com/papers/67-HW03.pdf

http://support.sas.com/onlinedoc/913/docMainpage.jsp

SAS OnlineDoc 9.1.3

SAS/GRAPH Reference > The ANNOTATE Facility

http://support.sas.com/onlinedoc/913/docMainpage.jsp