我想将变量从“旧”数据集连接到“新”数据集。UFORM变量的值为25或.。如果左联接为我提供了。的值,我想将其替换为值0。不能代替下面的sql语句中的UFORM变量的值来代替使UFORM2变量?
下面的语句有效,但我不想将UFORM2变量设置为变量。
proc sql; create table new as select X.*, Z.UFORM , case when Z.UFORM eq . then 0 else Z.UFORM end as UFORM2 from old X left join info Z on X.value1 = Z.value1 and X.value2 = Z.value2; quit;
这是你想要的吗?
proc sql; create table new as select X.*, coalesce(Z.UFORM, 0) as UFROM from old X left join info Z on X.value1 = Z.value1 and X.value2 = Z.value2; quit;