如何将proc sql的聚合值分配给本地SAS?

时间:2013-08-06 01:35:41

标签: sas

我无法调试以下proc sql

%local datasetCount;
%let datasetCount = 0;

proc sql;
            select count(*)
            from path.dataset_list
            into: &datasetCount.;  * I also tried into: datasetCount;
quit;

我的语法错误是什么?我得到以下

ERROR 22-322: Syntax error, expecting one of the following: ;, ',', ANSIMISS, CROSS, EXCEPT, FULL,
              GROUP, HAVING, INNER, INTERSECT, JOIN, LEFT, NATURAL, NOMISS, ORDER, OUTER, RIGHT,
              UNION, WHERE.

ERROR 76-322: Syntax error, statement will be ignored.

1 个答案:

答案 0 :(得分:2)

您的订单有误。如果& datasetcount是包含要存储到的变量名称(可能不包含)的宏变量的名称,则只能使用&符号。

proc sql;
select count(1) into :datasetcount from path.dataset_list;
quit;