BookmarkSubscribeRSS Feed
ballardw
Super User
I ran into some odd behavior with an annotate data set where I am placing squares as a symbol for one response group. All of the squares are the same color definition but the last one in the group is usually displayed in another color. I have stripped the data and code down to the following example.

When I tried this with different colors in the RECT macro call sometimes all of them seem similar in color but for most the last record in the data shows in a different color that does change depending upon the color specified and sometimes the active ODS style. The example below, running on Windows XP, SAS 9.2 TS Level 1 M0 with the SAS supplied MEADOWS style draws for raspberry colored rectangles and one dark blue (left bottom).

The coordinates used when displayed with my map data using GMAP do draw squares but GANNO below is re-scaling to use the values provided.

My questions are:
Does anyone else see this behavior?
What I am I missing to get all of these the same color.


%annomac;
data myanno;
input X Y ;
retain xsys ysys '2' when 'a';
step= 0.0015;
x1= x-step; x2=x+step;y1=y-step;y2=y+step;
%rect(x1,y1,x2,y2,H05A66AA,1,2);
drop step;
cards;
-0.030992 0.038752
-0.004153 -0.051241
-0.034223 0.016177
-0.026260 -0.033128
-0.034592 -0.024228
run;

proc ganno annotate=myanno datasys;run;quit;
1 REPLY 1
ArtC
Rhodochrosite | Level 12
The annomac %RECT is calling for the POLYLINE, which I believe has been replaced with the POLY function. I do not know what the interaction is, but replacing the macro call with its resultant code and replacing POLYLINE with POLY seemed to clear up the problem on my test. the code snippet becomes:
[pre]
%*rect(x1,y1,x2,y2,H05A66AA,1,2);
/*IF "H05A66AA" =: '*' THEN ;*/
/*ELSE */
color = "H05A66AA" ;
LINE = 1;
SIZE = 2;
x=x1;
y=y1;
function="POLY ";
output;
x=x2;
y=y1;
function="POLYCONT";
output;
x=x2;
y=y2;
function="POLYCONT";
output;
x=x1;
y=y2;
function="POLYCONT";
output;
x=x1;
y=y1;
function="POLYCONT";
output;
[/pre]
Another reason I tend to shy away from the %annomac macros.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1548 views
  • 0 likes
  • 2 in conversation