Say I have simulated data:
data d1;
do i=1 to 1000;
x1=rand('binomial',.1,1);
x2=rand('binomial',.3,1);
x3=rand('binomial',.6,1); x4=rand('binomial',.8,1);
y=x1+x2+x3+x4;
output;
end;
run;
and a second one row dataset:
data d2;
input x1 x2 x3 x4;
cards;
0 0 0 0
;
run;
and I want join on the list of all x variables x1-x4 in d2 without typing a long ON statement:
%let k=4;
proc sql;
create table join1 as
select a.*, b.*
from d1 a, d1 b
on x1:x&k;
quit;
Is there a quick way to do this or do I need to perhaps use a macro to construct a string "on a.x1=b.x1, a.x2=b.x2, . . ."?
Thanks!
... View more