I'm trying to send 2 SGPLOT charts to PowerPoint - each to its own slide, using Title/Footnote statements. First PowerPoint slide looks great - second slide has duplicate titles and footnotes - both within the chart space, and outside it! How do I prevent the "outside" titles and footnotes from appearing?
SAS code below, and results of the 2 slides (in PDF format) attached.
title; footnote; * Reset titles and footnotes to blanks;
ods _all_ close;
ods graphics/ reset noborder width=8.5in height=6.0in; * PPTX setting;
ods escapechar='^';
options orientation=landscape;
ods powerpoint file="C:\Test.pptx" options(backgroundimage="C:Test.png");
ods layout gridded y=0.25in;
title1 "My Title1"; title2 "My Title2":
footnote1 "My footnote1"; footnote2 "My footnote2"; footnote3 "My footnote3";
proc sgplot data=myData;
....
run;
proc sgplot data=myData2;
...
run;
ods layout end;
ods powerpoint close;
Thanks for checking that, Chris. Perhaps I'm using an older version of SAS - SAS 9.4 TS Level 1M5 on Windows 7?
(Regarding the colon after the title statement -- that was a typo -- in the real code I used a semi-colon as required).
I was able to solve the problem myself by deleting the "ods layout gridded y=0.25in;" line (and the "ods layout end" line).
The code was working fine before I added the "ods layout" lines. I only added it because I wanted the chart on the PowerPoint slide to start 0.25in vertically down from the standard top margin, because I had a background image banner that was in that space, and I didn't want the chart to overwrite it.
I figured out another way to get the extra top margin -- I added an options statement before the "ods powerpoint" statement like this:
options topmargin=0.5in; <== that changed the default 1/4-inch top margin to 1/2 inch, an additional 1/4-inch, that is
And this -- along with deleting the "ods layout" lines -- now make my output in PowerPoint look the way I want.
1. You have a colon after title2
2. No issues for me
title; footnote; * Reset titles and footnotes to blanks;
ods _all_ close;
ods graphics/ reset noborder width=8.5in height=6.0in; * PPTX setting;
ods escapechar='^';
options orientation=landscape;
ods powerpoint file="\\Nz8037spsas2003\r&c1\02 DEVELOPMENT\ECL Calculator\Test.pptx" ;*options(backgroundimage="C:Test.png");
ods layout gridded y=0.25in;
title1 "My Title1"; title2 "My Title2";
footnote1 "My footnote1"; footnote2 "My footnote2"; footnote3 "My footnote3";
proc sgplot data=SASHELP.CLASS;
scatter x=WEIGHT y=HEIGHT;
run;
proc sgplot data=SASHELP.CLASS;
scatter x=WEIGHT y=AGE;
run;
ods layout end;
ods powerpoint close;
Thanks for checking that, Chris. Perhaps I'm using an older version of SAS - SAS 9.4 TS Level 1M5 on Windows 7?
(Regarding the colon after the title statement -- that was a typo -- in the real code I used a semi-colon as required).
I was able to solve the problem myself by deleting the "ods layout gridded y=0.25in;" line (and the "ods layout end" line).
The code was working fine before I added the "ods layout" lines. I only added it because I wanted the chart on the PowerPoint slide to start 0.25in vertically down from the standard top margin, because I had a background image banner that was in that space, and I didn't want the chart to overwrite it.
I figured out another way to get the extra top margin -- I added an options statement before the "ods powerpoint" statement like this:
options topmargin=0.5in; <== that changed the default 1/4-inch top margin to 1/2 inch, an additional 1/4-inch, that is
And this -- along with deleting the "ods layout" lines -- now make my output in PowerPoint look the way I want.
Chris,
I finally tried your code -- and it didn't work for me! I see the same results I'm getting in my code -- your first page is OK, but 2nd page prints in PowerPoint with duplicate titles -- one set of titles across the top, and another set of titles within the chart itself, like this:
My Title1
My Title2
My Title1
My Title2
Can you tell me which version of SAS you are running? I am running base SAS on Windows 9.4 1M5
Bruce
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.