Can you please help me change all the fonts in the SGRENDER output to georgia?
data test;
infile datalines dlm='|';
input year :8. var :$3. val :8.;
datalines;
2014|RUC|17
2015|RUC|19
2016|RUC|22
2017|RUC|25
2018|RUC|26
2019|RUC|29
;run;
ods path (prepend) work.template(update);
proc template;
define style graphfonts;
parent=styles.default;
style graphfonts from graphfonts /
'graphdatafont'=('georgia',8pt)
'graphlabelfont'=('georgia',8pt)
'graphfootnotefont'=('georgia',8pt)
;
end;
define statgraph econ_data_plots;
begingraph / designwidth=650 designheight=350;
dynamic val time graphtitle;
entrytitle graphtitle /*halign=left*/ /*textattrs=(family="georgia")*/;
layout lattice / rows=1 columns=1 rowgutter=10 columngutter=10;
layout overlay;
seriesplot x=time y=val / lineattrs=(pattern=dash color=blue);
endlayout;
entryfootnote halign=left "Solid 2015Q3, Dash 2015Q2";
endlayout;
endgraph;
end;
run;
proc sgrender data=test template=econ_data_plots;
dynamic graphtitle='Scenario' val='val' time='year' ;
run;
In order for the new style to be used, it has to be specified when opening a ODS destination.
So your code should look similar to the one below:
ods html file="c:\temp\sample.html"
style=graphfonts
;
proc sgrender data=test template=econ_data_plots;
dynamic graphtitle='Scenario' val='val' time='year' ;
run;
ods html close;
Bruno
In order for the new style to be used, it has to be specified when opening a ODS destination.
So your code should look similar to the one below:
ods html file="c:\temp\sample.html"
style=graphfonts
;
proc sgrender data=test template=econ_data_plots;
dynamic graphtitle='Scenario' val='val' time='year' ;
run;
ods html close;
Bruno
With some slight adjustments to take care of the other graph font definitions... This worked like a champ, thanks Bruno
ods path (prepend) work.template(update);
proc template;
define style graphfonts;
parent=styles.default;
style graphfonts from graphfonts /
'graphdatafont'=('georgia',8pt)
'graphlabelfont'=('georgia',8pt)
'graphfootnotefont'=('georgia',8pt)
'graphvaluefont'=('georgia',8pt)
'graphtitlefont'=('georgia',8pt)
;
end;
define statgraph econ_data_plots;
begingraph / designwidth=650 designheight=350;
dynamic val time graphtitle;
entrytitle graphtitle;
layout lattice / rows=1 columns=1 rowgutter=10 columngutter=10;
layout overlay;
seriesplot x=time y=val / lineattrs=(pattern=dash color=blue);
endlayout;
entryfootnote halign=left "Solid 2015Q3, Dash 2015Q2";
endlayout;
endgraph;
end;
run;
ods html style=graphfonts;
proc sgrender data=test template=econ_data_plots;
dynamic graphtitle='Scenario' val='val' time='year' ;
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.