# Creating Proportional Venn Diagrams Using Google and SAS®

## Presentation on theme: "Creating Proportional Venn Diagrams Using Google and SAS®"— Presentation transcript:

Creating Proportional Venn Diagrams Using Google and SAS®
Hillary Kruger, RTI International, USA

Proportional Venn Diagrams
What are Venn diagrams? Why use them? What are good and bad examples? How are they made in SAS® with Google? Resources and References

What is a Venn Diagram?

Why Choose a Venn Diagram?
+ Venn diagrams are an effective and efficient way to show overlapping data + Universally useful across disciplines + Easy to understand for a variety of audiences + Recent resurgence in popularity

Venn Diagrams Some Venn diagrams are not mathematically accurate, but are still useful - or at least entertaining These are a reflection of the general public’s interest in Venn diagrams.

Venn Diagrams To accurately reflect data sets, one must create diagrams that show the true overlap in data This squared diagram is considered a type of Venn, and shows all the data, but is not proportional.

Venn Diagrams in SAS® SAS® offers Venn options (like below) but they are not proportional Notice that these show you all the sets sizes but the area of the shapes do not reflect the data set sizes.

Proportional Venn Diagrams in SAS®
Others have addressed this previously, using tedious code, and produced the following results: I’ve included part of the code here for producing this Venn. You may not be able to see all of it, but the part in the square is only calculating the radii for the circles. There are two more pages of code to be implemented before this chart can be created. That said, I do recommend this paper to anyone interested in the topic and will include this information in my reference section.

Proportional Venn Diagrams
RECAP: current options FAIR: Interesting; not mathematical GOOD: Not visually accurate BETTER: Not visually interesting The last one here isn’t terrible, but it also isn’t ideal.

Proportional Venn Diagrams New Option: Google and SAS® BEST: Visually interesting and mathematically accurate; simple implementation

Pros and Cons SAS® Only PROS: Mathematically accurate CONS: Visually uninteresting; tedious code SAS® and Google Pros: Mathematically accurate; plethora of visualization options; simple application Cons: ?? You might be apprehensive to try a new language – but only the most rudimentary understanding of HTML is required.

A Simple Venn Diagram Using Google
Here are the basic components for Google chart calls: cht=<chart_type> & chd=<chart_data> & chs=<chart_size> &...additional_parameters... cht = v & chd= t : 50,60,0,20,0,0,0 & chs= 300x225 & chco= FF6342,ADDE63 & There are many possible charts Google offers, including pie, bar, line, and even radial charts. This is the generic ‘starter’ code for all Google charts. Go through each item.

Venn Diagrams Using Google and SAS®
cht=<chart_type> & chd=<chart_data> & chs=<chart_size> &...additional_parameters... %let type = v; ** CHART TYPE v=venn; %let col1 = FF6342; ** A COLOR; %let col2 = ADDE63; ** B COLOR; %let col3 = 63C6DE; ** C COLOR; %let dat1 = 35; ** SIZE OF A; %let dat2 = 30; ** SIZE OF B; %let dat3 = 15; ** SIZE OF C; %let dat4 = 8; ** A+B OVERLAP; %let dat5 = 5; ** A+C OVERLAP; %let dat6 = 3; ** B+C OVERLAP; %let dat7 = 4; ** A+B+C OVERLAP; %let lab1 = Circle+A; ** LABEL A; %let lab2 = Circle+B; ** LABEL B; %let lab3 = Circle+C; ** LABEL C; %let widt = 300; ** WIDTH IN DPI; %let heig = 300; ** HEIGHT IN DPI; %let size = &widt.x&heig.; ** WIDTHxHEIGHT; %let lege = t; ** LEGEND t=top; %let titl = Venn+Diagram; ** TITLE; %let mar1 = 5; ** MARGIN LEFT; %let mar2 = 5; ** MARGIN RIGHT; %let mar3 = 5; ** MARGIN TOP; %let mar4 = 5; ** MARGIN BOTTOM; Starting with the most basic code, we can create more complex examples. All we need are the building blocks. I’ve created a macro to assign all the possible attributes to the diagram. The only necessary numbers are the ones indicated in the box.

Venn Diagrams Using Google and SAS®
%let type = v; ** CHART TYPE v=venn; %let col1 = FF6342; ** A COLOR; %let col2 = ADDE63; ** B COLOR; %let col3 = 63C6DE; ** C COLOR; %let dat1 = 35; ** SIZE OF A; %let dat2 = 30; ** SIZE OF B; %let dat3 = 15; ** SIZE OF C; %let dat4 = 8; ** A+B OVERLAP; %let dat5 = 5; ** A+C OVERLAP; %let dat6 = 3; ** B+C OVERLAP; %let dat7 = 4; ** A+B+C OVERLAP; %let lab1 = Circle+A; ** LABEL A; %let lab2 = Circle+B; ** LABEL B; %let lab3 = Circle+C; ** LABEL C; %let widt = 300; ** WIDTH IN DPI; %let heig = 300; ** HEIGHT IN DPI; %let size = &widt.x&heig.; ** WIDTHxHEIGHT; %let lege = t; ** LEGEND t=top; %let titl = Venn+Diagram; ** TITLE; %let mar1 = 5; ** MARGIN LEFT; %let mar2 = 5; ** MARGIN RIGHT; %let mar3 = 5; ** MARGIN TOP; %let mar4 = 5; ** MARGIN BOTTOM; The macro call code I’ll be happy to share with anyone. The code on the prior slide creates this Venn diagram. My point here is to show how simple creating these charts can be.

References Azimaee , Mahmoud. KML Macro: Integrating SAS ® and Google API and Its Application in Mapping Manitoba's Health Data on Google Earth and Google Map. SAS Global Forum 2010. Google Chart Tools / Interactive charts (aka Visualization API) Query Language Reference (Version 0.7). Available online: Harris, Kriss. How To Generate 2, 3 and 4 Way Venn Diagrams with Drill Down Functionality within 4 minutes! SAS Global Forum 2008. Li, Shiqun (Stan). Using SAS ® to Create Proportional Venn Diagrams. SAS Global Forum 2009 Massengill, Darrell. Google Maps and SAS/Graph ®.. SAS Global Forum 2010. Roehl, William G. Bridging the Gap between the Google Analytics API and SAS ®. SAS Global Forum 2010. Recommend / explain that paper that has good information on how to find the different group sizes….

Contact Information Hillary Kruger 3040 E. Cornwallis Road Cox 220 Durham, NC Phone: (919)