我有一个以下列方式的数据集示例
data have;
input match percent;
cards;
0 34
0 54
0 33
0 23
1 60
1 70
1 70
1 70
;
基本上我想总结与0
相关联的观察值,然后将它们除以0
的数量以找出平均值。
例如34 + 54 + 33 + 23/4然后对1
'
我看了PROC TABULATE。但是,我不了解如何执行此程序。
答案 0 :(得分:1)
在SAS中有很多方法可以做到这一点。我会使用PROC SQL
proc sql noprint;
create table want as
select match,
mean(percent) as percent
from have
group by match;
quit;
答案 1 :(得分:1)
你可以使用proc means
,你将平均加上一堆其他统计数据:
proc means
的更多示例here。
proc means data=have noprint;
by match;
output out=want ;
输出:
答案 2 :(得分:0)
使用proc summary
或proc means
可以非常轻松地完成此操作。
proc summary data=have nway missing;
class match;
var percent;
output out=want mean=;
run;
您还可以使用这些程序输出各种其他统计数据。