Click here to see the SAS code.
Click here to see the example.
Click here to see 'vennmap_inc.sas'.

This is an enhanced version of tech support's annotated venn example,
but using SAS/Graph 'proc gmap' instead of annotated circles.

For this gmap version, each segment of the venn diagram is a totally
separate map area, so the color/drilldown/etc of each piece can be
controlled separately (not possible in the annotated overlapping 
circles version).

To create the sas/graph map data set containing the outline of each
of these areas, I first wrote a little piece of code that lets me
give it the x/y center of a circle, and the radius, and the 
number of degrees angle, and it calculates the x/y coordinates of
the points along the arc along the outside edge of that segment 
of the circle.  (I stored this code in 'vennmap_inc.sas', and I
use an %include statement in my sas job when I need to re-use 
that code -- this could be done in many other ways.)

Then I painstakingly worked out the geometry for each circle.
I located the centers of the 3 circles 1-radius apart, so that the
geometry was easiest (the 3 centers form an eqi-triangle, and 
therefore each arc is 60 degrees, or a multiple of 60).

When creating the sas/graph map data set, remember that the x/y 
coordinates of the outlines of each area will be connected in 
the order in which you specify them in the data set, so be sure
to specify them in order (clockwise or counterclockwise).

Then I annotate the labels in the center of each geometric area.
Since the areas are fairly regular shapes, I just use the 
'average' x/y as the center.  (If you have a new/recent version
of v9 sas, you could use the new 'centroid' macro to calculate
a good center coordinate.)

For the colors, you specify the 3 colors of the outside circles,
and the colors for the overlapping segments are calculated to
simulate blending (using an imperfect algorithm).  It will probably
look best if you stick with shades of reb/green/blue for the 3 
outer circles.  If you don't like the calculated/mixed colors,
you can override them by specifying any color you would like
in the pattern statements.

One big advantage of the gmap venn is that gmap holds very strictly
to keeping it's x/y coordinates proportional.  By comparison, the 
in the annotated version, the x/y for the center, and the value for
the pie (circle) radius are (usually) in different coordinate systems,
so it's harder to calculate the exact circle geometry you're wanting
when you use annotated pies.

Back to Samples Index