01
entrytitle 'R' {sup '2'};坐标轴标签× 图例×。
entrytitle "R(*ESC*){unicode '00B2'x}";坐标轴标签√ 图例×。
entrytitle "(*ESC*){unicode mu}(*ESC*){unicode hat} =";坐标轴标签√ 图例×。
label="C(*ESC*){unicode '2098'x}(*ESC*){unicode '2090'x}(*ESC*){unicode '2093'x}"
有些字体显示不了,显示模糊。
entrytitle "R²";
坐标轴标签√ 图例√。
drawtext 'C' {sub 'max'} / x=-9.8 y=50.6 rotate=90 DRAWSPACE=DATAPERCENT WIDTH=100 WIDTHUNIT=PERCENT;
可以添加在任何地方,需注意绘图顺序和图层覆盖的情况。
/* Create sample data */
data a;
input x y;
datalines;
25.6
37.2
18.5
43.5
58.3
;
run;
/* Set the graphics environment */
goptions reset=all border htitle=pt htext=pt;
symbol1 interpol=none value=dot color=CX7C95CA height=1.7;
axis1 label=(height= pct ' ') minor=none offset=(pct,pct);
axis2 label=(angle= height= pct ' ') minor=none;
title1 height=pt ' ';
/* Add a superscript to the title */
title2 height=pt 'Superscripts and Subscripts' move=(+.3,+) height=pt '(1)';
/* Add extra white space below the graph */
footnote1 height=pt ' ';
footnote2 height=pt angle=' ';
/* Create the graphics output */
proc gplot;
plot y*x / haxis=axis1 vaxis=axis2;
/* Horizontal axis label */
note font='Albany AMT/bold'
move=(,)pct height=pt 'H' move=(+.5,-.75) height=pt '2'
move=(+.8,+.75) height=pt 'O' move=(+.5,+.75) height=pt '2';
/* Vertical axis label */
note font='Albany AMT/bold'
move=(,)pct height=pt 'N' move=(+.5,+.75) height=pt '2';
note font='Albany AMT/bold'
move=(,)pct height=pt 'H' move=(+.5,-.75) height=pt '2';
run;
quit;
测试过程的代码如下:
proc template;
define statgraph dynamics;
mvar SYSDATE9 SCALE;
nmvar BINS;
dynamic VAR VARLABEL;
begingraph;
entrytitle 'R' {sup '2'};
entrytitle "R(*ESC*){unicode '00B2'x}";
entrytitle "(*ESC*){unicode mu}(*ESC*){unicode hat} =";
layout overlay / xaxisopts=(label="C(*ESC*){unicode '2098'x}(*ESC*){unicode '2090'x}(*ESC*){unicode '2093'x}"
labelattrs=(FAMILY="Times New Roman")) yaxisopts=(label=VARLABEL);
histogram VAR / scale=SCALE group=GHDD nbins=BINS name="GHDD";
densityplot VAR / normal();
drawtext 'C' {sub 'max'} / x=-9.8 y=50.6 rotate= DRAWSPACE=DATAPERCENT WIDTH= WIDTHUNIT=PERCENT;
discretelegend "GHDD";
endlayout;
endgraph;
end;
run;
%let bins=;
%let scale=count;
ods escapechar="^";
data GHDD;
set sashelp.class;
GHDD=ifc(sex="F","R²","C^{sub min)");
run;
/*ods rtf file="D:\test.rtf";*/
proc sgrender data=GHDD
template=dynamics;
dynamicvar="Height" varlabel="C^{sub max)";
run;
/*ods rtf close;*/
绘图TEXT命令: Text Commands
{ SUB "string" | dynamic }
text-command that specifies that the string or dynamic is to appear as subscript text. See “Rules for Unicode and Special Character Specifications” on page 1208 Example entry "y = " b{sub "0"} " + b" {sub "1"} "x";
{ SUP "string" | dynamic }
text-command that specifies that the string or dynamic is to appear as superscript text. See “Rules for Unicode and Special Character Specifications” on page 1208 Example entry "R" {sup "2"} " = " {format (
6.4
) RSQUARED} ;
{ UNICODE "hex-string"x | keyword | dynamic }
text-command that specifies a glyph (character) to be displayed using its Unicode specification or keyword equivalent. "hex-string"x a four-byte hexadecimal constant that represents a UNICODE character in the current font. For a complete listing, see http://unicode.org/charts/charindex.html. keyword a SAS keyword for a UNICODE character. For a listing of keywords supplied by SAS, see “Reserved Keywords and Unicode Values” on page 1208. dynamic a dynamic variable that resolves to either "hex-string"x or a keyword for a UNICODE character. Note The UNICODE text command attempts to access a UNICODE value in the current font. Not all fonts support accessing characters through their UNICODE value. Some fonts support only a limited set of UNICODE values. If the UNICODE value is not accessible, then the command might be ignored or a nonprintable character might be substituted. See “Using UNICODE Text” on page 1207 “Rules for Unicode and Special Character Specifications” on page 1208 Example entry {unicode alpha} "=" CONF; entry {unicode "03B1"x} "=" CONF;
参考链接: https://blog.csdn.net/weixin_49282401/article/details/119687253
尊敬的读者,首先感谢您对本篇文章的关注和阅读。在此,本小编想要说明的是,以上所述内容都是经过笔者认真整理和撰写的,但限于个人能力和知识水平等因素,难免存在疏漏或错误之处。如有不当之处,敬请包涵并指正,本小编将虚心接受您的批评与建议,并严谨修正文章。再次感谢您对本篇文章的支持与厚爱。