标题: 如何SQL 简化计算 [打印本页] 作者: shiyiming 时间: 2010-5-3 15:07 标题: 如何SQL 简化计算 请问如下程序 可以怎么简化计算啊
proc sql noprint;
create table hind1 as
select distinct stkcd, dt, sum(stakeQ*stakeQ) as Hind1
from yyy
where Acquchrct in (1,2,3,6,7)
group by stkcd;
quit;
proc sql noprint;
create table hind2 as
select distinct stkcd, dt, sum(stakeQ*stakeQ) as Hind2
from yyy
where Acquchrct in (4,5,8,9)
group by stkcd;
quit;
proc sql noprint;
create table hind3 as
select distinct stkcd, dt, sum(stakeQ*stakeQ) as Hind3
from yyy
where Acquchrct in (13,12,14,16,17)
group by stkcd;
quit;
proc sql noprint;
create table hind4 as
select distinct stkcd, dt, sum(stakeQ*stakeQ) as Hind4
from yyy
where Acquchrct in (23,22,24,26,27)
group by stkcd;
quit;