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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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