Chapter Contents


SAS/GRAPH Software: Reference

Using Annotate Macros

Macro Structure

The general form of an Annotate macro is

%MACRO (parameters);

In general, the macro name represents a function and the parameters contain the values for the variables that can be used with the function. All macros except DCLANNO, SYSTEM, and SEQUENCE output an observation.

The parameters are either numeric or character. Numeric parameters can be numeric constants or numeric variable names that have been initialized to the appropriate value. Most character parameters must be expressed as literals, that is character strings without quotation marks. Exceptions are the text values that are used with the COMMENT and LABEL macros, which can be expressed as character strings enclosed in quotation marks or as character variable names.

The Annotate facility assigns the parameter values to the corresponding Annotate variables. Therefore, the observations in an Annotate data set that is created with macros that look the same as the ones that you created with assignment statements.

Making the Macros Available

To use Annotate macros, you must provide your program with access to the data set that contains the macros, and you must compile the macros before you use them. Check with your SAS Software Consultant to find out if the fileref for the data set that contains the Annotate macros that are supplied with SAS/GRAPH software is allocated automatically at your site. Then access the Annotate macros in one of these ways:

Annotate Macro Task Summary

The following table summarizes the tasks performed by the Annotate macros.

Tasks with Annotate Macros
If you want to... Use this macro...
assign values of (XLSTT,YLSTT) to (XLAST,YLAST) %TXT2CNTL;
begin drawing a polygon %POLY(x, y, color, style, line);
continue drawing a polygon %POLYCONT(x, y, color);
declare all variables %DCLANNO;
draw a bar %BAR(x1, y1, x2, y2, color, line, style);
draw a circle %CIRCLE(x, y, size, color);
draw a frame %FRAME(color, line, size, style);
draw a line from (XLAST,YLAST) to (XLSTT,YLSTT) %DRAW2TXT(color, line, size);
draw a line from previous point %DRAW(x, y, color, line, size);
draw a line %LINE(x1, y1, x2, y2, color, line, size);
draw a pie slice or arc %SLICE(x, y, angle, rotate, size, color, style, line);
draw a rectangle %RECT(x 1,y 1,x 2,y 2, color, line, size);
draw text %LABEL(x, y, text, color, angle, rotate, size, style, position);
exchange the values of (XLAST,YLAST) and (XLSTT,YLSTT) %SWAP;
move to a point near a pie slice %PIEXY(angle, size);
move to a point without drawing %MOVE(x, y);
put values into a stack %PUSH;
retrieve values from a stack %POP;
scale and move input %SCALET(ptx, pty, x0, y0, x1, y1, x0, vy0, vx1, vy1);
scale input %SCALE(ptx, pty, x0, y0, x1, y1, x0, vy0, vx1, vy1);
set the coordinate system for the observation %SYSTEM(xsys, ysys, hsys);
set when to draw an observation %SEQUENCE(when);
write a comment to the data set %COMMENT(text);

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.