【问题标题】:SAS PROC REPORTSAS 过程报告
【发布时间】:2014-10-10 13:25:44
【问题描述】:

我有以下数据集(虚构数据):

data have;
    input team $ goals_12 goals_13 var_12_13;
cards;
LIV 20 25 .25
MNC 21 24 .14
MUN 30 25 -.17
ARS 10 12 .20
CHE 23 23 0
EVE 20 18 -.1
TOT 10 0 -1
;
run;

我正在尝试为此数据集创建报告。这是我所拥有的:

proc report data=have;
    column team goals_12 goals_13 var_12_13;
    define team / 'Team';
    define goals_12 / analysis '2012 Goals';
    define goals_13 / analysis '2013 Goals';
    define var_12_13 / order analysis format=percent. mean "Variance '12 to '13";
    rbreak after / summarize ul ol;
run;

几乎做了我想要的一切。以下是我无法弄清楚的事情:

  1. 将摘要行命名为“摘要”
  2. 按 var_12_13 降序排列,因此方差最大的团队排在第一位
  3. 我需要将方差列的摘要作为总计的方差,而不是方差的平均值(因此应该是 -5%)

【问题讨论】:

    标签: report sas


    【解决方案1】:

    试试这个:

    proc sort data=work.have; by descending var_12_13;
    
    proc report data=have;
        column team goals_12 goals_13 var_12_13;
        define team / 'Team';
        define goals_12 / analysis '2012 Goals';
        define goals_13 / analysis '2013 Goals';
        define var_12_13 / order=data analysis format=percent. mean "Variance '12 to '13" weight=goals_13;
    
        compute team;
        if _BREAK_ in ('_RBREAK_') 
            then do;
                team="Summary";
            end;
        endcomp;
    
        rbreak after / summarize ul ol;
    run;
    

    【讨论】:

    • 这非常接近。出于某种原因,-1 没有转换为团队 TOT 的 (100%)。另外,我可以格式化 5% 以显示这是一个负数吗?现在它看起来像一个正方差。另外,我想使用 proc 排序,但认为 proc 报告有一种内部方法可以按变量排序。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多