- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用 SAS 9.3 并尝试遵守 DRY通过定义自定义样式并将其与整个 PROC TEMPLATE 的统计图 block 中的多个 ENTRY 语句一起使用。
自定义样式:
proc template;
define style llama;
parent=styles.fancyPrinter;
style CustomFonts from GraphFonts /
'GraphValueFont'=("<sans-serif>, <MTsans-serif>",25pt,italic)
;
class foo from GraphValueText /
font = CustomFonts('GraphValueFont')
color = GraphColors('gtext');
end;
run;
然后通过 ODS 语句中的 style= 选项打开。我尝试使用 foo:
Entry halign=left "bar / 1000" / textattrs=foo;
但得到日志信息:
NOTE: The style element 'foo' in the option TEXTATTRS is invalid. The default will be used.
当使用这样的定义设置 TEXTATTRS 时它工作正常(但由于我多次使用它,它不会是 DRY):
textattrs=GraphValueText(weight=bold size=16pt color=CX800080)
此外,我知道 ODS 正在读取样式定义,因为如果我这样做:
style GraphFonts from GraphFonts
并更改字体,它会影响图表。
最佳答案
不幸的是,对于如何做到这一点,我没有很好的答案,尽管可能存在。
我确实认为 GTL 并未完全听取您的意见。例如:
proc template;
define style llama;
parent=styles.fancyPrinter;
style CustomFonts from GraphFonts /
'GraphValueFont'=("<sans-serif>, <MTsans-serif>",25pt,italic)
;
style graphUnicodeText from GraphValueText /
color=red;
style graphValueText from GraphValueText/
color=green;
end;
run;
proc template;
define statgraph entry;
begingraph;
layout overlay;
entry halign=right "First entry statement" /
valign=top textattrs=graphValueText;
histogram weight;
entry halign=right "Second entry statement" /
textattrs=graphUnicodeText;
entry halign=right "Third entry statement" /
valign=bottom pad=(bottom=40px);
endlayout;
endgraph;
end;
run;
ods _all_ close;
ods html file="c:\temp\test.html" path="" gpath="c:\temp\" style=llama;
proc sgrender data=sashelp.class template=entry;
run;
ods html close;
请注意,您不会收到有关 GraphUnicodeText 的任何错误...但您也不会从中得到任何影响。我的猜测是 GTL 只是在部分了解风格的情况下开展工作,因此无法始终尊重您的要求。
我的建议(至少直到/除非 Sanjay 或 Dan 或类似人员可以帮助您找到更好的)是为此目的使用宏变量和/或动态变量。
proc template;
define style llama;
parent=styles.fancyPrinter;
style CustomFonts from GraphFonts /
'GraphValueFont'=("<sans-serif>, <MTsans-serif>",25pt,italic)
;
style graphUnicodeText from GraphValueText /
color=red;
style graphValueText from GraphValueText/
color=green;
end;
run;
proc template;
define statgraph entry;
begingraph;
layout overlay;
dynamic entrycolor;
entry halign=right "First entry statement" /
valign=top;
histogram weight;
entry halign=right "Second entry statement" /
textattrs=(color=entrycolor);
entry halign=right "Third entry statement" /
valign=bottom pad=(bottom=40px);
endlayout;
endgraph;
end;
run;
ods _all_ close;
ods html file="c:\temp\test.html" path="" gpath="c:\temp\" style=llama;
proc sgrender data=sashelp.class template=entry;
dynamic entrycolor="red";
run;
ods html close;
然后您可以在模板的多个位置重用entrycolor
,并允许用户在运行时指定它。这并不理想,但它确实有效,至少...
关于sas - 在 PROC TEMPLATE 中使用自定义类而不是 GraphValueText 作为 textattrs 选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31864519/
有没有办法从 .sas 文件中打开 SAS 数据集进行查看(即在“ViewTable”窗口中)? 最佳答案 我认为这会做你想做的: dm log "vt sashelp.air"; 只需更改 "sas
如何在 SAS 程序中将 sas 数据表 (sas7bdat) 设置为只读? — 即使在 session 之间,该表也必须保持只读状态,尤其是当另一个用户注册该库并尝试写入数据集时。一旦创建了这些表,
如何将 mmddyy 变量转换为 date9 变量?例如,假设我们有以下内容: x = 05/10/2011 我希望 x 的形式为 10May2011。所以我做了以下事情: xnew =
我正在使用以下代码将文本文件导入 SAS: proc import datafile="C:\Users\Desktop\data.txt" out=Indivs dbms=dlm replace;
您好,我有兴趣为我在 SAS 中生成的数据制作一些稍微复杂的自定义格式。我需要它是数字类型。 格式 1 0="-" >0="%" %" 即 0 >>>>>>> - .74 >>>>> 74% -.65
我正在尝试弄清楚如何读取文本文件 (300mb) 中以逗号分隔但数据位于一行中的数据。 数据看起来像这样: a,b,c,d,e,f,g,h,i,j,k,l,m,false,false,true,1,3
我想将 SAS 数据集从 SAS 导出到 FTP。我可以使用以下命令导出 csv 文件(或 txt 文件): %macro export_to_ftp(dsn= ,outfile_name= ); F
这个问题在 SAS forum 上讨论过,与会者最终同意不同意。 问题很简单:SAS 在编译时为所有变量分配一个缺失值UNLESS一个变量出现在sum 语句中(在这种情况下,SAS 在编译时分配了一个
众所周知,SAS需要特别注意句子中的引号。 例如 %let quoted="I'd like to"; data temp; set temp; quoted=""ed"; r
我对 SAS 完全陌生,我很绝望。 所以,我的代码是: DATA abc; INPUT AA BB CC DD EE; CARDS; ; RUN; PROC PRINT DATA = abc; T
我在使用如下所示的数据集时遇到问题。它是不同位置/周的库存计数: data have; input itm location $ week inv; cards; 3 x 1 30 3 x 2
我们需要确定我们现在使用的是什么类型的 SAS(pc SAS 或服务器 SAS)。有什么方法可以找出我们使用的是什么 SAS,是指 PC SAS 还是 SAS Server? 最佳答案 使用“proc
假设我有一个包含 n 行和 p 列的数据集,这样数据集中的每个条目都包含一个实数。我正在寻找一种方法来对每行中的 p 列进行排名。这个排名的输出应该是一个长度 - p 的排名向量,它说明了关系。 所以
我正在尝试打印一个带分隔符的文件,而不必指定所有列。我可以接近,但数字列总是被引用: DATA _NULL_; SET SASHELP.CARS (obs = 5 keep = Make Mode
SAS 软件可以成功读取的最大文件大小是多少。(不考虑硬件限制) 提前致谢。 最佳答案 引用最近播放的电视广告,答案是“无限加 1”。 SAS 在读取操作期间对文件的大小没有任何限制,尽管您可能会遇到
我有一个包含变量 y、x1 和 x2 的数据集。我想找到适合模型的方程式: y = k1*x1c1 + k2 *x2c2 通过找到 k1、c1、k2 和 c2。我如何在 SAS 中执行此操作?具体来说
SAS中是否有用于定义数组中字母序列的简写? 许多语言都具有轻松执行此操作的机制,我想SAS也是如此,尽管我找不到它的引用。 例如,在R中,我可以做 > x x [1] "a" "b" "c" "d
我有两个 SAS 数据集。第一个相对较小,包含唯一的日期和相应的 ID: date dateID 1jan90 10 2jan90 15 3jan90 20 ... 第二个
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我有一个主要是数值的变量,但是偶尔会有一个字符偷偷进入。因此,变量在 SAS 中存储为字符。我希望能够确定此字符变量中的各个值是否为数字。在知道哪些值是数字哪些是字符后,我想创建一个新的(数字)变量,
我是一名优秀的程序员,十分优秀!