Proc制表的加权平均值

时间:2018-10-11 16:51:11

标签: sas

我想在proc表格中查看加权平均值。我该怎么办?

proc tabulate data=Result;
var ltv_max_onoff;
class Exposure_class_std_method;
table Exposure_class_std_method, ltv_max_onoff*mean;
run;

我认为我需要在“ ltv_max_onoff”之后指定其他内容。另外,我需要指定要对其加权的变量。有效的类似代码是Proc Summary:

proc summary data=Result nway;
        var ltv_max_onoff;
        weight exp_distr_onoff;
        output out=WALTV (drop=_:)  mean= ;
run;

我希望在“ Proc制表”的每个类别(Exposure_class_std_method)中进行此操作。

我尝试将weight命令放入“ var”语句中

proc tabulate data=Result;
var ltv_max_onoff weight=exp_distr_onoff;
class Exposure_class_std_method;
table Exposure_class_std_method, ltv_max_onoff;
run;

无法识别:

enter image description here

1 个答案:

答案 0 :(得分:1)

使用WEIGHT语句或VAR语句上的WEIGHT =选项。