When using font Times New Roman to display legend label, the subscript 3 cannot be displayed. If I change to other font such as "Monotype Sans WT J", the subscript can display. Does anyone know how to display subscript in DISCRETELEGEND in TNR font ? Many thanks!
Following is the SAS code and the test dataset is also attached
/*--------------------------------------------------------------------------------*/
ods path work.templates(update) sashelp.tmplmst(read) sasuser.templat(update);
proc template;
define style test/store=templates;
parent = Styles.rtf ;
class graphwalls /
frameborder=off;
class fonts / 'TitleFont' = ("Times New Roman, Times Roman, Times", 10pt ,Bold ) 'TitleFont2' = ("Times New Roman, Times Roman, Times", 10pt ,Bold ) 'footFont' = ("Times New Roman, Times Roman, Times", 10pt ) 'StrongFont' = ("Times New Roman, Times Roman, Times", 10pt,Bold) 'EmphasisFont' = ("Times New Roman, Times Roman, Times", 10pt,Italic) 'headingEmphasisFont' = ("Times New Roman, Times Roman, Times", 10pt,Bold) 'headingFont' = ("Times New Roman, Times Roman, Times", 10pt,Bold) 'docFont' = ("Times New Roman, Times Roman, Times",10pt) 'FixedEmphasisFont' = ("Times New Roman, Times Roman, Times", 10pt) 'FixedStrongFont' = ("Times New Roman, Times Roman, Times", 10pt,Bold) 'FixedHeadingFont' = ("Times New Roman, Times Roman, Times", 10pt,Bold) 'BatchFixedFont' = ("Times New Roman, Times Roman, Times", 10pt) 'FixedFont' = ("Times New Roman, Times Roman, Times", 10pt) ;
class color_list / 'link'= blue 'bgH' = white 'bgT' = white 'bgD' = white 'fg' = black 'bg' = white ;
style Table from Output / rules = groups cellpadding = 1px cellspacing = 0 bordercolor = lightgrey frame=hsides ;
class systemtitle / protectspecialchars=OFF asis=ON ;
class systemfooter / font=Fonts('footFont') protectspecialchars=OFF asis=ON ;
class text / 'continued' = " " ;
class continued / pretext=text('continued') width=_undef_ frame=void rules=none borderspacing = 0 padding = 0 ;
class header / protectspecialchars=off ;
class data / protectspecialchars=off ;
class rowheader / protectspecialchars=off ;
class usertext / protectspecialchars=off ;
class byline / protectspecialchars=off ;
style graphfonts from graphfonts / "graphdatafont" =("TIMES NEW ROMAN",10pt)
"graphlabelfont" =("TIMES NEW ROMAN",10pt,Bold)
"graphfootnotefont"=("TIMES NEW ROMAN",10pt)
"graphvaluefont" =("TIMES NEW ROMAN",10pt)
"graphtitlefont" =("TIMES NEW ROMAN",12pt,Bold)
"graphunicodefont"=("TIMES NEW ROMAN",10pt);
end;
define style intexttable;
parent=styles.rtf;
style TableHeaderContainer from TableHeaderContainer / bordertopwidth=6 bordertopcolor=red borderbottomwidth=12 borderbottomcolor=blue borderbottomstyle=dotted;
style TableFooterContainer from TableFooterContainer / bordertopwidth=6 bordertopcolor=red bordertopstyle=double;
style table from table / cellspacing=0 rules=groups frame=void;
style Table from Output / rules = none cellpadding = 1px cellspacing = 0 bordercolor = lightgrey frame=hsides asis=ON ;
class systemtitle / protectspecialchars=OFF asis=ON ;
class systemfooter / font=Fonts('footFont') protectspecialchars=OFF asis=ON ;
class text / 'continued' = " " ;
class continued / pretext=text('continued') width=_undef_ frame=void rules=none borderspacing = 0 padding = 0 ;
end;
run;
proc template;
define statgraph aebar;
begingraph/collation=binary subpixel=on designwidth=9.5 in designheight=6.5 in attrpriority=NONE
;
entrytitle halign=left textattrs=GraphTitleText(color=black weight=bold size=10pt)
"Adverse Events";
layout overlay/
xaxisopts=(label=" ")
yaxisopts=( display= ALL LabelPosition=CENTER label="% of Subjects" labelFitPolicy=Split type=LINEAR linearopts=( tickvaluelist=( 0 20 40 60 80 100 ) viewmax=100 ) );
;
barchart x=text y=prop/group=actarmcd groupdisplay=cluster name="arm";
discretelegend "arm"/across=1 valign=top halign=right location=inside;
endlayout;
endgraph;
end;
run;
proc sgrender data=test template=aebar;
run;
Use the "Times New Roman Uni" font.That should work for you.
Use the "Times New Roman Uni" font.That should work for you.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.