更新时间:2023-10-23 22:43:34
如何避免 SAS 覆盖我的数据集..." - 如果您的意思是在记录级别覆盖 - 检查 _iorc_
值会让你控制做什么.您可以添加自己的逻辑来更新下面的模板代码.不匹配的值为_DSENMR".
"How can I avoid SAS to overwrite my dataset..." - if you mean overwriting on record level - checking _iorc_
value will give you control on what to do. You can add own logic to updates to the template code below.
Value for Not matched is "_DSENMR".
data have_1;
modify have_1 have_2(where=(message="X")) updatemode=nomissingcheck;
by reference;
if _iorc_ = %sysrc(_SOK) then do;
* Update row ;
replace;
end;
else if _iorc_ = %sysrc(_DSENMR) then do;
* Add row ;
output;
_error_ = 0;
end;
else if _iorc_ = %sysrc(_DSEMTR) then do;
* Multiple TRANSACTION data set observations do ;
* not exist in MASTER data set ;
_error_ = 0;
end;
else if _iorc_ = %sysrc(_DSENOM) then do;
* No matching observation was found in MASTER data set ;
_error_ = 0;
end;
run;
在此处查看更多信息 http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm