使用标签集 excelXP 对分组标题的背景进行着色
我正在尝试对 tagets.ExcelXP 报告中的分组标题进行着色,我知道如何对未分组列的标题进行着色,但不知道如何更改分组列的背景颜色。
这是我正在使用的示例代码:
data work.db;
infile datalines delimiter=';' dsd flowover;
input col01 col02 col03 col04 col05;
datalines4;
1;2;3;4;5
6;7;8;9;10
11;12;13;14;15
;;;;
run;
ods tagsets.ExcelXP file="c:\temp\example.xls";
proc report data=work.db nowd missing nocenter;
column
("group 1" col01 col02 col03 )
("group 2" col04 col05 )
;
define col01 / display style(header)={background=cxFFC000};
define col02 / display style(header)={background=cxFFC000};
define col03 / display style(header)={background=cxFFC000};
define col04 / display style(header)={background=cxC0FF00};
define col05 / display style(header)={background=cxC0FF00};
run;
ods tagsets.ExcelXP close;
当我运行此代码时,我得到以下结果: 上述代码的输出
这是我想要获得的: 我试图获取的输出
我必须如何修改代码来定义背景颜色分组单元格“组 1”和“组 2”的?
我尝试使用“内联格式”,但没有得到结果(您可以在下面看到我修改后的代码版本)
ods escapechar = '^';
ods tagsets.ExcelXP file="c:\temp\example.xls";
proc report data=work.db nowd missing nocenter style={protectspecialchars=off};
column
("^{style[background=cxFF0000]}group 1" col01 col02 col03 )
("group 2" col04 col05 )
;
define col01 / display style(header)={background=cxFFC000};
define col02 / display style(header)={background=cxFFC000};
define col03 / display style(header)={background=cxFFC000};
define col04 / display style(header)={background=cxC0FF00};
define col05 / display style(header)={background=cxC0FF00};
run;
ods tagsets.ExcelXP close;
当然,我遗漏了一些东西,但我无法“看到”我遗漏的内容。
有人可以帮助我或给我建议吗?
预先感谢,
科斯坦蒂诺
I'm trying to colorize the grouped headers in my tagsets.ExcelXP report, I know how to colorize the headers of the ungrouped columns but do not know how to change the background color of the grouped ones.
This is the sample code I'm using:
data work.db;
infile datalines delimiter=';' dsd flowover;
input col01 col02 col03 col04 col05;
datalines4;
1;2;3;4;5
6;7;8;9;10
11;12;13;14;15
;;;;
run;
ods tagsets.ExcelXP file="c:\temp\example.xls";
proc report data=work.db nowd missing nocenter;
column
("group 1" col01 col02 col03 )
("group 2" col04 col05 )
;
define col01 / display style(header)={background=cxFFC000};
define col02 / display style(header)={background=cxFFC000};
define col03 / display style(header)={background=cxFFC000};
define col04 / display style(header)={background=cxC0FF00};
define col05 / display style(header)={background=cxC0FF00};
run;
ods tagsets.ExcelXP close;
When I run this code I obtain this result:
Output of above code
And here what I'm trying to obtain:
Output that I'm trying to obtain
How I had to modify my code to define the background color of the grouped cell "group 1" and "group 2"?
I tried with "inline formatting" but got no result (you can see my modified version of the code below)
ods escapechar = '^';
ods tagsets.ExcelXP file="c:\temp\example.xls";
proc report data=work.db nowd missing nocenter style={protectspecialchars=off};
column
("^{style[background=cxFF0000]}group 1" col01 col02 col03 )
("group 2" col04 col05 )
;
define col01 / display style(header)={background=cxFFC000};
define col02 / display style(header)={background=cxFFC000};
define col03 / display style(header)={background=cxFFC000};
define col04 / display style(header)={background=cxC0FF00};
define col05 / display style(header)={background=cxC0FF00};
run;
ods tagsets.ExcelXP close;
Surely I'm missing something but I cannot "see" what I'm missing.
Someone can help or give me a suggestion?
Thanks in advance,
Costantino
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,不幸的是,这有点复杂。
如果您有至少一列不在分组下,则可以使用文本变量来完成此操作 - 但这仅在至少还有其他一列时才有效,原因并不完全有意义大部头书。
例如:
' '
使实际的组变量标签不显示,因此它显示变量内的文本,这样您就可以轻松设置样式。如果您不,那么我看到的除了 DDE 或 SAS Office 插件之外的唯一选项(DDE 不是一个很好的选择,因为它已被弃用并且没有得到很好的支持,SAS Office 插件是一个很好的选择,但它是一个单独的产品许可明智的)可能是使用 CSS 样式做一些复杂的事情...您可以识别组所属的类并执行第一个子项第二个子项选择器。但这确实很复杂,而且基本上是手动的 - 如果有任何变化,你必须记住更改 CSS。类似于级联样式表:打破 ODS 样式的框< /a> 凯文·史密斯。
So, this is somewhat complicated, unfortunately.
If you have at least one column that's not under the groupings, you can do it with a text variable - but this only works if there's at least one other column, for reasons that don't entirely make sense to me.
For example:
The
' '
makes the actual group variable label not show, so instead it shows the text inside the variable, and that works as you can easily style that.If you don't, then the only option I see other than DDE or SAS Office Add-in (DDE is not a great option as it's deprecated and not well supported, SAS Office add-in is a great option but it's a separate product licensing wise) is maybe doing something complicated using a CSS style... you could identify the class the groups belong to and do a first-child second-child selector. But that's really complicated and basically manual - if anything changes you have to remember to change the CSS. Something like in Cascading Style Sheets: Breaking Out of the Box of ODS Styles by Kevin Smith.