SAS:放入新的 table 样本均值

SAS: put in a new table means of samples

我是 SAS 的初学者,但我没有成功:

我有一个 table(我们称它为 table1),其中包含与两个变量 X 和 Y 关联的 100 个样本:

Number of sample X Y
1 8 7
1 3 4
1 11 11
2 14 2
2 14 2
2 17 -2
... ... ..

我想创建一个新的 table (table2),其中包含每个样本的 X 均值(我必须使用 proc 均值)。

所以结果一定是这样的: table2

你能帮帮我吗? 提前谢谢你,

拉拉帕

ps:每个样本都具有相同的大小 (3)。

documentation 非常详细地介绍了 Proc MEANS 的操作。

对于初学者,试试这个例子:

data have;
input id x y;
datalines;
1   8   7
1   3   4
1   11  11
2   14  2
2   14  2
2   17  -2
;

proc means nway noprint data=have;
  by id;
  var x;
  output out=want(keep=id mean_x) mean=mean_x;
run;