EDITED.
data T1 T2 T3 T4 T5;
do I=1 to 1000;
if ranuni(0)>.6 then output T1;
if ranuni(0)>.6 then output T2;
if ranuni(0)>.6 then output T3;
if ranuni(0)>.6 then output T4;
if ranuni(0)>.6 then output T5;
end;
run;
%macro intersect(list= T1 T2 T3 T4 T5 );
%let n=%sysfunc(countw(&list , %str( ) ));
proc sql;
create table temp as
%do i=1 %to &n ;
%let a=%scan(&list,&i,%str( ));
%do j=1 %to &n ;
%let b=%scan(&list,&j,%str( ));
select "&a" as dsn1 length=40,"&b" as dsn2 length=40,count(*) as n from(
select * from &a
intersect
select * from &b
)
%if &i ne &n or &j ne &n %then %do; union %end;
%end;
%end;
;quit;
%mend;
options mprint mlogic symbolgen;
%intersect()
proc transpose data=temp out=want(drop=_:);
by dsn1;
id dsn2;
var n;
run;
... View more