UPDATE 语句使新数据集的数据替换旧数据集的数据,用法和 MERGE 类似。语法:
DATA master-data-set; UPDATE master-data-set transaction-data-set; BY variable-list;
和 MERGE 的区别在于:1)mstter-dataset 必须在 BY variables 上 unique. 2)只能合并两个数据集 3)transaction-dataset 中的缺失值不会替换 master-dataset 对应的值,即只会替换非缺失值。
例子
original data: perm.patientmaster
new data: transactions
/*Need to sort by BY variables first*/
DATA perm.patientmaster; UPDATE perm.patientmaster transactions; BY Account; PROC PRINT DATA = perm.patientmaster; FORMAT BirthDate LastUpdate MMDDYY10.; TITLE 'Admissions Data'; RUN;
上述结果中,只有perm.patientmaster的非缺失值被更新了。
标签:set,patientmaster,UPDATE,perm,dataset,statement,SAS,data From: https://www.cnblogs.com/zooz-logging/p/16750039.html