第一张表a为大类商品,Commodity为Aerospace1;第二张表b为小类商品,Commodity为Aerospace2;
如果直接用a.Aerospace1-b.Aerospace2 ,则有aerospace1而无Aerospace2的值在新表中都会编程缺失值(可见如下程序)。
create table g7.Aerospace as
SELECT distinct a.Reporter, a.Partner, a.Aerospace1-b.Aerospace2 as aerospace, a.Year
FROM g7.aerospace1 as a FULL JOIN g7.aerospace2 as b
on a.Reporter = b.Reporter and a.Partner = b.Partner and a.Year = b.Year;
quit;
现在想实现的是,若aerospace2存在,则用a.Aerospace1-b.Aerospace2得到新表中的aerospace;若aerospace2不存在,则直接为新表中aerospace取a.aerospace1的值。
之前发帖提了一个问题得到了论坛上达人们的完美解决,非常感谢哈!
希望有大侠能帮忙指导一下这个问题,谢啦!



雷达卡


京公网安备 11010802022788号







