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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.