|
楼主

楼主 |
发表于 2012-4-24 16:00:29
|
只看该作者
求高手相助!proc SQL相关问题
向大家请教个问题,在书上看到的:其中的group by 1的作用是什么?还是说是错误的,因为编译没通过。相关代码如下:
data chapt4.retain1;
input id txn_cde$ cns txn_dte$;
cards;
10 101 10 20070101
10 101 20 20080402
10 201 30 20050203
20 101 40 20040105
20 201 50 20040105
20 301 60 20070806
20 201 70 20050607
30 301 80 20070501
30 401 90 20070306
;
run;
proc sql;
create table sum as
select
id
,sum(cns) as cns
,count(*) as count
,sum(case when txn_cde in("101" "201") then 1 else 0 end) as cnt_condi
,min(txn_dte) as min_txn_dte
from chapt4.retain1;
group by 1
;
quit;
编译时,group 处出现以下语句:ERROR 180-322: 语句无效或未按正确顺序使用。 |
|