Proc Means vs Simple Count in Proc SQL for non numeric values

Proc Means vs Simple Count in Proc SQL for non numeric values

我有很多场景,在这些场景中,以下查询会提供我需要的东西 -

proc sql;
   create table test as
   select ID,count(task) as count
   from table 
   group by ID;
quit;

我尝试使用 proc means 来复制它以扩展我的方法 -

proc means data = table noprint;
   class ID;
   var task;
   output out=test sum=tot;
run;

我收到一条错误消息 -

ERROR: Variable TASK in list does not match type prescribed for this list.

我假设这是因为我告诉它 "sum" 一个字符变量,而我真正想要做的是 "count" 通过 ID 观察。 "sum" 一词可能不是此处使用的关键字,但我不知道还有什么其他关键字可以通过 ID 给我一个 "count"。这是 proc 方法步骤中的简单语法错误,还是错误的方法?

_FREQ_

proc means data = table noprint;
class ID;
output out=test;
run;