我被授予此代碼運行,但我仍然收到錯誤,即使我已經確定有正確數量的左/右括號。這是原始代碼,因爲我添加的括號似乎在錯誤的地方。與proc中的嵌套select語句問題sql
proc sql;
create table all as
select distinct a.id, a.count, b.date
from (select distinct id, count (*) as count from (select distinct id, p_id, date2 from table1) group by id) a
(select distinct id, min(date2) as date format datetime. from table1) b
where a.id=b.id;
quit;
(select distinct id, min(date2) as date format datetime. from
-------- -
22 22
202 76
3520! table1) group by id) b
ERROR 22-322: Syntax error, expecting one of the following:), ','.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
ERROR 76-322: Syntax error, statement will be ignored.
編輯:添加一個逗號後,然後我得到這個錯誤:
256 , (select id, min(date2) as date format datetime. from
256! table1) group by id) b
-
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &, (, *, **, +, ',', -,
'.', /, <, <=, <>, =, >, >=, ?, AND, BETWEEN, CONTAINS, EQ, EQT, EXCEPT, GE, GET,
GT, GTT, HAVING, IN, INTERSECT, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN,
OR, ORDER, OUTER, UNION, ^, ^=, |, ||, ~, ~=.
ERROR 76-322: Syntax error, statement will be ignored.
257 Where a.id=b.id;
258 quit;
我thnk @sushil是正確的,是有缺失的逗號,但我也認爲你需要在你的格式聲明等號「FORMAT =日期時間。」 – 2015-04-02 16:51:15