我的設(shè)想是按不同的分組變量求和,最后把新的求和變量和原數(shù)據(jù)放到一個表里;括號里面是兩個子查詢計算變量,第一次用了begindate作分組變量求和,第二次用了begindate,prodtype作分組變量求和;
但是結(jié)果總是出現(xiàn)“error: 子查詢不止一行”;
程序如下:
proc sql;
create table test01 as
select begindate,prodtype,principal,
(select begindate,sum(principal) as sumpp2
from task01_raw
group by begindate),
(select begindate,prodtype,
sum(principal) as sumpp1
from task01_raw
group by begindate,prodtype)
from task01_raw;
quit;
求教如何實現(xiàn)