BookmarkSubscribeRSS Feed
louisehadden
Quartz | Level 8

Does anyone have any thoughts for generating tiny line plots to center on each state (in place of or along with a state abbreviation)?  If I generated each little plot with a tiny x and y pixel size separately it seems like I could create an annotate data base that could include these just as one includes the state abbreviations - something similar to the pre and post image commands in ODS.  Alternatively, has anyone had experience annotating unicode characters on a map - I could display a trend indicator using unicode characters if nothing else.  The output will be PDF.  Thanks in advance for any suggestions!

I will be trying to do a similar thing in PROC REPORT, annotating the little plots in one of the columns of the report.

Cheers, Louise

2 REPLIES 2
GraphGuy
Meteorite | Level 14

I was hoping someone might have a slick/graceful/easy way to do this (maybe a macro or something)...

But since nobody has posted one up, I'll provide some info on how this could 'hypothetically' be done...

Similar to how you can annotate text on a GMap (using the annotate 'label' function), you can also annotate images on a GMap (using the 'image' function) ... in this case, the images would be very small GPlots that you have created ahead of time.  The 'trick' (ie, the difficult part) is that you cannot easily center the image over the map areas like you can the text (using position='5').

With an annotated image, you must specify the bottom/left corner, and the top/right corner.  Therefore the way to "center" an image on a certain location on a GMap is to first 'move' to the center (using xsys/ysys=2), and then change to the relative % coordinate system (xsys/ysys=9) and move a slight bit to the left & down for the bottom/left corner of the image, and then 2-times that offset amount for the top/right corner of the image.  Here's an example (it annotates hockey team images instead of sparkline graph images)...

data logo_anno; set logo_anno (keep = x y x_offset y_offset country province city Teamname logo);
  length function style $8 html $1000;
  hsys='3'; when='a';
  xsys='2'; ysys='2'; function='move'; output;
  xsys='9'; ysys='9';
  x=-2.0+x_offset; y=-2.5+y_offset; function='move'; output;
  html='alt="'||trim(left(Teamname))||'" href="http://www.google.com/search?&q='||trim(left(Teamname))||'"';

  x=2.0*2; y=2.5*2; function='image'; imgpath=logo; style='fit'; output;
run;

And the output it produces:

http://robslink.com/SAS/democd32/hockey.htm

http://robslink.com/SAS/democd32/hockey_info.htm

-----

An *alternative* which doesn't require annotate, and doesn't require coming up with coordinates for the bottom/left & top/right corner of each annotated image, might be to use javascript "popup" images for the graphs.  Here is an example:

http://robslink.com/SAS/democd51/census_2010.htm

http://robslink.com/SAS/democd51/census_2010_info.htm

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 762 views
  • 0 likes
  • 3 in conversation