I am trying to publish various charts that are created in SAS into powerpoint slides. However when I try to change the title size using
ods powerpoint layout=twocontent;
title1 height=32pt " CHART TITLE" ;
SAS output font is always 42pt.
on the other hand if I use
ods powerpoint layout=_null_;
title height=32pt "CHART TITLE";
the font changes.
I figured that I can use proc template to modify existing layouts (such as : twocontent), however I couldn't find an example in the SAS documentation so far that I can use. The examples that I found are mainly for ODS pdf outputs.
Instead of modifying the layout template (which you can't do), modify the style template. This works for me using SAS 9.4M3:
ods path (prepend) work.templat(update);
proc template;
define style styles.mystyle;
parent = styles.powerpointlight;
class SystemTitle /
fontsize=32pt;
end;
run;
proc sort data=sashelp.class out=class;
by sex;
run;
ods powerpoint file="test.pptx" style=styles.mystyle;
ods powerpoint layout=twocontent(advance=bygroup) nogtitle;
title1 'CHART TITLE';
proc sgplot data=class;
by sex;
vbar name /response=height;
run;
ods powerpoint close;
Instead of modifying the layout template (which you can't do), modify the style template. This works for me using SAS 9.4M3:
ods path (prepend) work.templat(update);
proc template;
define style styles.mystyle;
parent = styles.powerpointlight;
class SystemTitle /
fontsize=32pt;
end;
run;
proc sort data=sashelp.class out=class;
by sex;
run;
ods powerpoint file="test.pptx" style=styles.mystyle;
ods powerpoint layout=twocontent(advance=bygroup) nogtitle;
title1 'CHART TITLE';
proc sgplot data=class;
by sex;
vbar name /response=height;
run;
ods powerpoint close;
@Tim_SAS thank you very much for your response.
It's great to know that I cannot modify the layout template as that's why I have been trying.
Also if I want to modify other title sizes (not the main title but the smaller ones) in the same slide, should I do it under the same class statement?
There are 10 SystemTitle classes, one for each possible title statement. Their names are SystemTitle (for title1) and SystemTitle2-SystemTitle10. If you want to modify the style for title2 use the SystemTitle2 class. When you modify one of the SystemTitle classes, all of the higher-numbered SystemTitle classes automatically get the modification as well. So if you set the fontsize of SystemTitle2 to, say, 24pt, then SystemTitle3-SystemTitle10 get that fontsize. The PowerPointLight and PowerPointDark styles specify that SystemTitle uses fontsize=42pt, SystemTitle2 uses fontsize=24pt, and SystemTitle3-SystemTitle10 uses fontsize=20pt.
You can read more about ODS styles here.
Here's how to view the PowerPointLight and PowerPointDark styles that we supply for the destination for PowerPoint.
Good luck!
Thank you @Tim_SAS great information!
Yes I could get the custom font sizes as you mentioned in your post by using the line below.
proc template;
define style styles.mystyle;
parent = styles.powerpointlight;
class SystemTitle /
fontsize=28pt;
class SystemTitle2 /
fontsize=20pt;
end;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.