Using sas v 9.4, I am trying to get my graphs in the correct format for a specific journal. All of the graph text including axis labels and tick mark labels need to be Arial 8 point font. I am able to create an editable graph so that I can open in ods graphics editor and easily change the axis label font and size, but not the size of the font for the tick marks with the following code:
ods graphics on;
ods listing style=statistical sge=on;
proc glimmix;
class trainer;
model resp=trainer/ link=log solution;
random int/ subject=horse type=ar(1);
lsmeans trainer/ ilink cl adjust=tukey plot=meanplot(ilink);
run;
How can I change the font size for the tick marks?
Thank you!
Katy
An alternative to Draycut's suggestion is to derive a new Style from the one you want (say HTMLBlue), and change the GRAPHVALUEFONT setting in the "class GraphFonts" section. Then, use this style with your program. With "sans-serif", you will likely get Arial, but you can specify Arial if you want.
proc template;
define style myStyle;
parent = Styles.HTMLBlue;
style GraphFonts from GraphFonts
"Fonts used in graph styles" /
'GraphValueFont' = ("<sans-serif>, <MTsans-serif>",8pt);
;
end;
ods html style=htmlblue;
proc sgplot data=sashelp.class;
vbar age;
run;
ods html style=myStyle;
proc sgplot data=sashelp.class;
vbar age;
run;
I don't think the option exists in PROC GLIMMIX itself. But you can modify the underlying template that creates the graph like this.
I took an example from the SAS documentation for demonstration purposes. I use ODS TRACE ON before the GLIMMIX Procedure to find the relevant template. Then I write the template to the log with the following PROC TEMPLATE. Finally, I simply Copy Paste the PROC TEMPLATE into my editor, make the relevant changes, run the revised PROC TEMPLATE and rerun the PROC GLIMMIX.
/* GLIMMIX Example from SAS Documentation */
data plants;
input Type $ @;
do Block = 1 to 3;
input StemLength @;
output;
end;
datalines;
Clarion 32.7 32.3 31.5
Clinton 32.1 29.7 29.1
Knox 35.7 35.9 33.1
;
/* Use ODS Trace On to find the used template for the DiffPlot */
ods graphics on;
ods trace on;
ods select DiffPlot;
proc glimmix data=plants order=data plots=Diffogram;
class Block Type;
model StemLength = Block Type;
lsmeans Type;
run;
ods graphics off;
/* Write the template to the log */
proc template;
source Stat.Graphics.DiffPlot;
run;
/* - Copy/Paste in the PROC TEMPLATE Step from the log
- Make the relevant changes to the template
- Rerun the PROC GLIMMIX */
proc template;
source Stat.Graphics.DiffPlot;
define statgraph Stat.Graphics.DiffPlot;
dynamic _Title _Ylabel _LegTitle _cpoint _lines _byline_ _bytitle_ _byfootnote_;
BeginGraph / designwidth=defaultDesignHeight;
entrytitle _TITLE;
layout lattice / rows=1 columns=1;
layout overlayequated / equatetype=square yaxisopts=(display=(line ticks tickvalues)
offsetmin=0.04 offsetmax=0.04 griddisplay=off)
/* Make the change to the template here */
xaxisopts=(display=(line ticks tickvalues) offsetmin=0.04 offsetmax=0.04 griddisplay=off TICKVALUEATTRS=(SIZE=8));
seriesplot y=YVL x=XVL / break=true lineattrs=GRAPHGRIDLINES datatransparency=0
rolename=(_id1=ID_REF) tip=(_id1);
seriesplot y=YHL x=XHL / break=true lineattrs=GRAPHGRIDLINES datatransparency=0
rolename=(_id1=ID_REF) tip=(_id1);
lineparm slope=1 y=0 x=0 / clip=true lineattrs=GRAPHREFERENCE (pattern=dash)
extend=true;
if (_LINES)
seriesplot y=LSM_ x=LSM / break=true group=GROUP index=INDEX lineattrs=(
thickness=GraphFit:linethickness) rolename=(_id1=ID_COMP) tip=(_id1) name=
"Means" primary=true;
endif;
if (_CPOINT=1)
if (_LINES)
scatterplot y=LSM_Y x=LSM_X / group=GROUP index=INDEX markerattrs=(symbol=
GraphDataDefault:MarkerSymbol) rolename=(_id1=ID_MX _id2=ID_MY _id3=ID_CB
) tip=(_id1 _id2 _id3);
else
scatterplot y=LSM_Y x=LSM_X / group=GROUP index=INDEX rolename=(_id1=ID_MX
_id2=ID_MY _id3=ID_DIFF _id4=ID_CB) tip=(_id1 _id2 _id3 _id4) name=
"Means" primary=true;
endif;
endif;
scatterplot y=MIN x=LSM1 / markerattrs=(size=0) datalabel=LEVEL;
scatterplot y=LSM2 x=MAX / markerattrs=(size=0) datalabel=LEVEL;
endlayout;
columnheaders;
discretelegend "Means" / title=_LEGTITLE titleattrs=GRAPHVALUETEXT valign=bottom
halign=center across=2;
endcolumnheaders;
endlayout;
if (_BYTITLE_)
entrytitle _BYLINE_ / textattrs=GRAPHVALUETEXT;
else
if (_BYFOOTNOTE_)
entryfootnote halign=left _BYLINE_;
endif;
endif;
EndGraph;
end;
run;
An alternative to Draycut's suggestion is to derive a new Style from the one you want (say HTMLBlue), and change the GRAPHVALUEFONT setting in the "class GraphFonts" section. Then, use this style with your program. With "sans-serif", you will likely get Arial, but you can specify Arial if you want.
proc template;
define style myStyle;
parent = Styles.HTMLBlue;
style GraphFonts from GraphFonts
"Fonts used in graph styles" /
'GraphValueFont' = ("<sans-serif>, <MTsans-serif>",8pt);
;
end;
ods html style=htmlblue;
proc sgplot data=sashelp.class;
vbar age;
run;
ods html style=myStyle;
proc sgplot data=sashelp.class;
vbar age;
run;
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.