sas - 使用 proc 报告在 RTF 输出中水平合并单元格
问题描述
我正在尝试在数据中的每个组上方创建一个摘要行。我有两个问题:
- 如何在摘要行中水平合并前 2 个单元格(下面的红色单元格)。
- 如何删除 Sex 列中重复的 F 和 M(目前我可以通过仅将这些单元格的文本颜色更改为白色来解决此问题,但希望有更好的方法)
输出是一个 RTF 文件,我使用的是 SAS 9.4 - 桌面版本。
这可以使用 proc 报告吗?
代码:
options missing=' ';
proc report data=sashelp.class nowd;
columns sex name age weight;
define sex / order;
break before sex / summarize;
run;
解决方案
我认为您不能合并汇总行中的单元格。
compute
块的一些技巧,call define
可以改变单元格的值和外观。
例如(对于较小的图像只有 J 名称):
proc report data=sashelp.class nowd;
where name =: 'J';
columns sex name age weight;
define sex / order;
define age / sum;
define weight / sum;
break before sex / summarize style=[verticalalign=bottom];
compute name;
* the specification of / order for sex sets up conditions in the name value
* that can be leveraged in the compute block;
if name = ' ' then do;
* a blank name means the current row the compute is acting on
* is the summarization row;
* uncomment if stat is not obvious or stated in title;
* name = 'SUM';
* 'hide' border for appearance of merged cell;
call define (1, 'style', 'style=[fontsize=18pt borderrightcolor=white]');
end;
else do;
* a non-blank name means one of the detail rows is being processed;
* blank out the value in the sex column of the detail rows;
* the value assignment can only be applied to current column or those
* to the left;
sex = ' ';
end;
endcomp;
compute after sex;
* if you want more visual separation add a blank line;
* line ' ';
endcomp;
run;
推荐阅读
- html - 角度材料表:取消绑定复选框单击行
- javascript - 如何将数组值插入对象?
- flutter - Flutter - 如果可能,我如何剪辑固定大小的渐变并为其设置动画?
- sql - 以十进制返回日期差异
- java - 在 getResources().getIdentifier() 中显示相同的图片
- rsa - 我们如何使用 libgcrypt 为 RSA 加密添加 pkcs1 填充?
- reactjs - 如何在功能组件中创建动态引用 - 使用 useRef Hook
- windows - 如何配置我的应用程序,使我的应用程序创建的 shell 链接获得 cmd.exe 的图标?
- excel - 使用 Find 在行中查找某些文本,然后在满足某些条件时从下面的行中提取数据
- java - 在 Win 10 的命令行中使用 Java 开关