多谢!我对宏不熟悉,但你的程序能解决我得问题!
附,整理后的程序:
%macro iter;
proc datasets;
delete result;
run;
%do i=1 %to 51;
data temp1 temp2;
set qsar.benzod_normal;
if _n_=&i then output temp2;
else output temp1;
run;
proc reg data=temp1 outest=temp(keep=nor_d1-nor_d7 intercept) noprint;
var _all_;
model nor_exp=nor_d1-nor_d7/selection=stepwise;
run;
proc iml;
use temp;
read var {nor_d1 nor_d2 nor_d3 nor_d4 nor_d5 nor_d6 nor_d7} into paravector;
read var {intercept} into intervalue;
use temp2;
read var {nor_d1 nor_d2 nor_d3 nor_d4 nor_d5 nor_d6 nor_d7} into onedata;
read var {nor_exp} into oneexp;
close;
do i=1 to 7;
if paravector[i]=. then paravector[i]=0;
end;
if intervalue=. then intervalue=0;
ds=(oneexp-onedata*paravector`-intervalue)##2;
create temp3 from ds;
append from ds;
run;
proc append base=result data=temp3;
run;
%end;
%mend;
%iter;
The basic rule is that if you want to run a PROC within a DO loop, you have to write the SAS program in Macro. A PROC automatically breaks a DO loop in SAS data step, so the data step DO loop will never be complete. Macro DO loop works only within a Macro program.