永遠祝福那可愛的兩隻笨貓。

data a1 a2 a3 a4 ;
do i=1 to 4;
do j=1 to 100;
y1=uniform(123);
x1=uniform(1234); x2=uniform(12345); x3=uniform(12345);
drop i j;
if i=1 then output a1;
else if i=2 then output a2;
else if i=3 then output a3;
else if i=4 then output a4;
end;
end;
run;
proc reg data=a1;
model y1=x1;
run;
proc reg data=a1;
model y1=x2;
run;
proc reg data=a1;
model y1=x3;
run;
%macro My_reg (mydata, myvar);
proc reg data=&mydata;
model y1=&myvar;
run;
%mend My_reg;
%My_reg (a1,x1);
%My_reg (a1,x2);
%My_reg (a1,x3);
%My_reg (a2,x1);
%My_reg (a2,x2);
%My_reg (a2,x3);
%My_reg (a3,x1);
%My_reg (a3,x2);
%My_reg (a3,x3);
%My_reg (a4,x1);
%My_reg (a4,x2);
%My_reg (a4,x3);
%macro My_reg1 ;
%do i=1 %to 4;
%do j=1 %to 3;
proc reg data=a&i;
model y1=x&j;
run;
%end;
%end;
%mend My_reg1;
%My_reg1;