【问题标题】:sas 9.3 - insert a new line with condition in proc reportsas 9.3 - 在 proc 报告中插入带有条件的新行
【发布时间】:2018-04-10 15:01:11
【问题描述】:

我想在一组每个 br 变量之后插入一个新行,但不是在 proc 报告中的 br=10 时。

我有如下编写的计算代码,但 if 条件似乎不起作用

compute after br/ style={borderrightwidth=2 bordertopwidth=1 borderleftwidth=2};
if br in (1,2,3,4,5,6,7,8,9) then do;
line ' ';
end;
endcomp;

如何去掉最后的空行?

【问题讨论】:

    标签: sas sas-macro enterprise-guide proc-report


    【解决方案1】:

    Proc REPORT 中的LINE 语句是无条件执行的。

    来自 SAS 帮助

    LINE 声明

    提供 PUT 语句的功能子集以供编写 自定义摘要。

    限制:
    此语句仅在计算块中有效 与报告中的位置相关联。
    您不能使用 LINE 条件语句中的语句(IF-THEN、IF-THEN/ELSE 和 SELECT),因为它在 PROC REPORT 执行完所有 计算块中的其他语句。

    您可以确保 LINE 的输出包含第 10 组的空白值。

    data have;
      do mygroup = 1 to 10;
        do seq = 1 to 5;
          x = mygroup * 100 + seq;
          output;
        end;
      end;
    run;
    
    ods html close;
    ods html;
    
    proc report data=have;
      define mygroup / order;
    
      compute after mygroup / style={borderrightwidth=12 bordertopwidth=11 borderleftwidth=12};
        length text $200;
        if mygroup in (1,2,3,4,5,6,7,8,9) then do;
          text = 'line from compute after mygroup.  mygroup=' || put(mygroup,2.-L);
        end;
        else
          text = ' ';
    
        line text $char200.;
      endcomp;
    run;
    

    【讨论】:

      猜你喜欢
      • 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
      相关资源
      最近更新 更多