Hello,
I use the sas macro below to make boxplots and I would like to increase the size of texts, axes and boxes to make graphics more readable after inserting them as images in a word document. How can I do it?
%MACRO proc_boxplot(fic_in,titre,var1,var2,var3,klar1,klar2,klar3); ODS GRAPHICS OFF; SYMBOL1 V=STAR C=GREEN ; SYMBOL2 V=TRIANGLE C=RED ; TITLE "&titre"; PROC BOXPLOT DATA=&fic_in; PLOT &var1*&var2=&var3/BOXSTYLE=schematicidfar SYMBOLORDER=DATA ; LABEL &var1="&klar1"; LABEL &var2="&klar2"; LABEL &var3="&klar3"; INSETGROUP n min max Q2 /POS=AXIS ; RUN; TITLE ""; GOPTIONS RESET=SYMBOL; ODS GRAPHICS ON; %MEND proc_boxplot;
Thanks
Hello,
On the PLOT statement, you may specify all the options on this page:
https://go.documentation.sas.com/doc/en/statug/15.2/statug_boxplot_syntax06.htm
ods graphics off;
title; footnote;
proc sort data=sashelp.class out=work.sclass; by sex; run;
proc boxplot data=work.sclass;
*by sex notsorted;
plot Height*Sex / ;
inset min mean max stddev /
header = 'Overall Statistics'
pos = tm;
insetgroup min max /
header = 'Extremes by Sex'
height=4;
run;
If still not satisfied, there are "10 possible ways" to make boxplots in SAS.
See for example the BOXPLOT statement in the SAS GTL (SAS Graph template Language).
And I am sure PROC SGPLOT allows for boxplots as well. PROC SGPLOT support AXISx(2) and AXISy(2) statements for axes definitions.
Regards,
Koen
Hello,
The INSET and INSETGROUP statements of the BOXPLOT procedure have options to specify font and font height.
Table 5: INSETGROUP Statement Options
Option | Description |
---|---|
CFILL= | Specifies color of inset background |
CFILLH= | Specifies color of inset header background |
CFRAME= | Specifies color of inset frame |
CHEADER= | Specifies color of inset header text |
CTEXT= | Specifies color of inset text |
FONT= | Specifies font of inset text |
FORMAT= | Specifies format of values in inset |
HEADER= | Specifies inset header text |
HEIGHT= | Specifies height of inset and header text |
NOFRAME | Suppresses frame around inset |
POSITION= | Specifies position of inset |
[EDIT] : this is of course BEFORE inserting them as images in a word document.
Koen
Thanks
With these options I can only change the font (example font=B) in insetgroup but I want to change the size of the lines (axes and box) on the graph and the texts in insetgroup (example font_size=16), which options do I use?
For the font size you may use HEIGHT= option, no?
I will check and come back to you.
Koen
Hello,
On the PLOT statement, you may specify all the options on this page:
https://go.documentation.sas.com/doc/en/statug/15.2/statug_boxplot_syntax06.htm
ods graphics off;
title; footnote;
proc sort data=sashelp.class out=work.sclass; by sex; run;
proc boxplot data=work.sclass;
*by sex notsorted;
plot Height*Sex / ;
inset min mean max stddev /
header = 'Overall Statistics'
pos = tm;
insetgroup min max /
header = 'Extremes by Sex'
height=4;
run;
If still not satisfied, there are "10 possible ways" to make boxplots in SAS.
See for example the BOXPLOT statement in the SAS GTL (SAS Graph template Language).
And I am sure PROC SGPLOT allows for boxplots as well. PROC SGPLOT support AXISx(2) and AXISy(2) statements for axes definitions.
Regards,
Koen
@Liamb wrote:
Thanks
With these options I can only change the font (example font=B) in insetgroup but I want to change the size of the lines (axes and box) on the graph and the texts in insetgroup (example font_size=16), which options do I use?
AXIS appearance options are in AXIS statements, set with the STYLE= option values 0 to 46 (0 means no line), WIDTH affects the axis line thickness unless Tick mark options also use width, in which case the ticks get the width, NOFRAME is required for this to change appearance for just the axis, otherwise the frame will get the thickness as well.
Line options on which portion of the box to what? LBOXES=linetype or variablename if you want the different boxes with different lines. The value or variable would be limited to the integers 1 to 46 corresponding to the line type.
Or perhaps it is time to change to Proc SGPLOT/SGPANEL.
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.