BookmarkSubscribeRSS Feed
SAS--_lover
Calcite | Level 5

Hello!

 

I need to plot a 4-way venn diagram in SAS 9.4 using the attached data. The counts that go into the 16 groups/regions of the diagram are as follows. I spent several hours trying to modify the 3-way venn diagram macro by 

 

I was wondering if someone could help me?

 

Thank you.

 

ABCD

Frequency

Region description

1000

475

A

0100

686

B

0010

139

C

0001

119

D

1100

206

Intersection of A and B

1010

115

Intersection of A and C

1001

106

Intersection of A and D

0110

117

Intersection of B and C

0101

68

Intersection of B and D

0011

49

Intersection of C and D

1110

383

Intersection of A, B and C

1101

152

Intersection of A, B and D

1011

175

Intersection of A, C and D

0111

74

Intersection of B, C and D

1111

431

Intersection of A, B, C and D

0000

9122

Outside the venn diagram

2 REPLIES 2
PGStats
Opal | Level 21

That is quite a challenge! Just in case you want to switch to something simpler, here is an alternative

 

proc format;
value A 0 = "a" 1 = "A";
value B 0 = "b" 1 = "B";
value C 0 = "c" 1 = "C";
value myD 0 = "d" 1 = "D";
run;

data freq;
input (A B C D) (1.) Freq Perc;
format a a. b b. c c. d myd.;
datalines;
1000	475	3.83
0100	686	5.52
0010	139	1.12
0001	119	0.96
1100	206	1.66
1010	115	0.93
1001	106	0.85
0110	117	0.94
0101	68	0.55
0011	49	0.39
1110	383	3.08
1101	152	1.22
1011	175	1.41
0111	74	0.60
1111	431	3.47
0000	9122	73.46
;

proc tabulate data=freq order=formatted;
class a b c d;
var freq perc;
label freq = "Frequency" perc = "Percent";
table 
    freq*format=5.0 perc*format=5.2,
    a=""*b="", 
    c=""*d=""*mean="";
run;
                   Frequency
                   ---------------------------------------------
                   |                   |     C     |     c     |
                   |                   |-----------+-----------|
                   |                   |  D  |  d  |  D  |  d  |
                   |-------------------+-----+-----+-----+-----|
                   |A        |B        |  431|  383|  152|  206|
                   |         |---------+-----+-----+-----+-----|
                   |         |b        |  175|  115|  106|  475|
                   |---------+---------+-----+-----+-----+-----|
                   |a        |B        |   74|  117|   68|  686|
                   |         |---------+-----+-----+-----+-----|
                   |         |b        |   49|  139|  119| 9122|
                   ---------------------------------------------
                  Percent
                   ---------------------------------------------
                   |                   |     C     |     c     |
                   |                   |-----------+-----------|
                   |                   |  D  |  d  |  D  |  d  |
                   |-------------------+-----+-----+-----+-----|
                   |A        |B        | 3.47| 3.08| 1.22| 1.66|
                   |         |---------+-----+-----+-----+-----|
                   |         |b        | 1.41| 0.93| 0.85| 3.83|
                   |---------+---------+-----+-----+-----+-----|
                   |a        |B        | 0.60| 0.94| 0.55| 5.52|
                   |         |---------+-----+-----+-----+-----|
                   |         |b        | 0.39| 1.12| 0.96|73.46|
                   ---------------------------------------------

(note: it would actually look decent in ODS RTF or PDF) 

PG
SAS--_lover
Calcite | Level 5

Thank you

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1492 views
  • 1 like
  • 2 in conversation