我正在尝试从表test_ctrl.control_s
更新test1.control_s的值。
我正在使用以下代码:
proc sql;
update test1
set control_s= (select control_s
from test_ctrl
inner join test1
on test1.custno=test_ctrl.custno
and test1.accno=test_ctrl.accno);
quit;
我正在处理数百万条记录。我必须使用加入,但我不能。
你不需要加入,你只需要使用一个相关的子查询。
proc sql;
update test1
set control_s= (select control_s
from test_ctrl
where test1.custno=test_ctrl.custno
and test1.accno=test_ctrl.accno);
quit;
下面是一个使用sashelp.class
的示例:
data class;
set sashelp.class;
height=0;
run;
data ht_data;
set sashelp.class;
keep name height;
run;
proc sql;
update class
set height = (
select height from ht_data
where ht_Data.name = class.name
);
quit;