options errorabend cpucount=8;
libname useg 'D:\useg';
%macro uh(x);
proc sql noprint;
select count(*) as n_train into: n_train from useg.Uid_htl_comm3_1;
quit;
%do k=1 %to 20;
%do i=1 %to &x;
data useg.u_&i;
set useg.u;
run;
data useg.h_&i;
set useg.h;
run;
data useg.uh_train_&i;
set useg.Uid_htl_comm3_1(where =( (&i-1)/&x * &n_train < id <= &i/&x * &n_train ));
keep m n score;
run;
proc sql noprint;
select count(*) as n_train_&i into: n_train_&i from useg.uh_train_&i;
quit;
proc iml;
use useg.u_&i;
read all into u;
use useg.h_&i;
read all into h;
use useg.uh_train_&i var{m,n,score};
read all into r;
%do j=1 %to &&n_train_&i;
%let m=r[&j,1];
%let n=r[&j,2];
u[&m,1]=u[&m,1]+0.1*( (r[&j,3]-(u[&m,1]*h[&n,1]+u[&m,2]*h[&n,2]))*h[&n,1]-0.1*u[&m,1] );
u[&m,2]=u[&m,2]+0.1*( (r[&j,3]-(u[&m,1]*h[&n,1]+u[&m,2]*h[&n,2]))*h[&n,2]-0.1*u[&m,2] );
h[&n,1]=h[&n,1]+0.1*( (r[&j,3]-(u[&m,1]*h[&n,1]+u[&m,2]*h[&n,2]))*u[&m,1]-0.1*h[&n,1] );
h[&n,2]=h[&n,2]+0.1*( (r[&j,3]-(u[&m,1]*h[&n,1]+u[&m,2]*h[&n,2]))*u[&m,2]-0.1*h[&n,2] );
%end;
create useg.u from u;
append from u;
create useg.h from h;
append from h;
quit;
proc sql noprint;
drop table useg.uh_train_&i,useg.u_&i,useg.h_&i;
quit;
%end;
%end;
%mend;
%uh(50);/*输入要切分的子样本个数*/
当运行到K=2,i=39时iml模块报如下错误:
NOTE: 从数据集 USEG.UID_HTL_COMM3_1. 读取了 76373 个观测
WHERE (id>2902185.4) and (id<=2978558.7);
NOTE: 数据集 USEG.UH_TRAIN_39 有 76373 个观测和 3 个变量。
NOTE: “DATA 语句”所用时间(总处理时间):
实际时间 0.71 秒
CPU 时间 0.71 秒
NOTE: “PROCEDURE SQL”所用时间(总处理时间):
实际时间 0.00 秒
CPU 时间 0.00 秒
NOTE: IML Ready
ERROR: Overflow error in *.