The SAS Output Delivery System and reporting techniques

I need ODS PowerPoint to go to a new slide

Reply
Contributor
Posts: 34

I need ODS PowerPoint to go to a new slide

So this is clearly not producing what I want. To me, this should fill up my first layout with two graphs and a table, then move to a new slide with two more graphs and a table.

 

options nodate papersize=(13.33in 7.5in);
ods graphics on/ reset border=off ANTIALIASMAX=100000 ATTRPRIORITY= COLOR SCALE = on;
ods powerpoint FILE="&path./&YYYYMM.\documents/testing.pptx" style=styles.mystyle;
ods graphics /HEIGHT = 4.4in WIDTH = 5.5in;

 

/*begin first slide*/

title "IBM";/*the slide title*/
ods layout gridded columns=2 rows=2;
ods region;/*top left*/
title "high/low";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="IBM"));
series x=date y=high;
series x=date y=low;
run;
ods region;/*top right*/
title "close";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="IBM"));
series x=date y=close;
run;

ods region column_span=2 ;/*need to span both columns*/
proc print data=sashelp.stocks(where=(stock="IBM") obs=3) ;
run;
title;
ods layout end;

 

/*second slide*/

title "Intel";/*the slide title*/
ods layout gridded columns=2 rows=2;
ods region;/*top left*/
title "high/low";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="Intel"));
series x=date y=high;
series x=date y=low;
run;
ods region;/*top right*/
title "close";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="Intel"));
series x=date y=close;
run;

ods region column_span=2 ;/*need to span both columns*/
proc print data=sashelp.stocks(where=(stock="Intel") obs=3) ;
run;
title;
ods layout end;


ods _all_ close;

 

But if I add:

data _null_;
dcl odsout obj();
run;

between the two layouts as recommended in this paper: support.sas.com/resources/papers/proceedings16/SAS5443-2016.pdf

 

I get everything garbled on the first page and no second page.

 

that code is as follows:

 

options nodate papersize=(13.33in 7.5in);
ods graphics on/ reset border=off ANTIALIASMAX=100000 ATTRPRIORITY= COLOR SCALE = on;
ods powerpoint FILE="&path./&YYYYMM.\documents/testing.pptx" style=styles.mystyle;
ods graphics /HEIGHT = 4.4in WIDTH = 5.5in;

title "IBM";/*the slide title*/
ods layout gridded columns=2 rows=2;
ods region;
title "high/low";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="IBM"));
series x=date y=high;
series x=date y=low;
run;
ods region;
title "close";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="IBM"));
series x=date y=close;
run;

ods region column_span=2 ;/*need to span both columns*/
proc print data=sashelp.stocks(where=(stock="IBM") obs=3) ;
run;
title;
ods layout end;

data _null_;
dcl odsout obj();
run;

title "Intel";/*the slide title*/
ods layout gridded columns=2 rows=2;
ods region;
title "high/low";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="Intel"));
series x=date y=high;
series x=date y=low;
run;
ods region;
title "close";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="Intel"));
series x=date y=close;
run;

ods region column_span=2 ;/*need to span both columns*/
proc print data=sashelp.stocks(where=(stock="Intel") obs=3) ;
run;
title;
ods layout end;


ods _all_ close;

 

What am I missing? How do I get my three regions on the first slide in one layout, then move to the next slide for the next three regions in another layout?

Super User
Posts: 13,523

Re: I need ODS PowerPoint to go to a new slide

Posted in reply to ANWZimmerman

I am a little concerned with this bit:

FILE="&path./&YYYYMM.\documents/testing.pptx"

why do you mix / and \ in the file name?

Contributor
Posts: 34

Re: I need ODS PowerPoint to go to a new slide

I'm running on Windows, they get treated the same. But some of the code I was cutting and pasting from comes from a coworker who does all his slashes like UNIX. I just didn't bother to alter his to match mine.

SAS Super FREQ
Posts: 820

Re: I need ODS PowerPoint to go to a new slide

Posted in reply to ANWZimmerman

Hi with SAS9.4M4 the STARTPAGE=NOW option was added to begin output on a new slide.

 

Find below your code with some modifications. 

Added the STARTPAGE=NOW

Also added some code since the table was not positioned properly

 

options nodate  center;
ods _all_ close;

ods graphics on/ reset border=off ANTIALIASMAX=100000 ATTRPRIORITY= COLOR SCALE = on;
ods graphics / HEIGHT = 3in WIDTH = 4in;

ods powerpoint FILE="c:\temp\testing.pptx" ;

/*begin first slide*/

title "IBM";/*the slide title*/
ods layout gridded columns=2 column_gutter=10px;
ods region;/*top left*/
title "high/low";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="IBM"));
series x=date y=high;
series x=date y=low;
run;
ods region;/*top right*/
title "close";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="IBM"));
series x=date y=close;
run;

ods layout end;
ods layout gridded columns=1;

ods region;
proc print data=sashelp.stocks(where=(stock="IBM") obs=3) ;
run;
title;
ods layout end;

ods powerpoint startpage=now;

/*second slide*/

title "Intel";/*the slide title*/
ods layout gridded columns=2 column_gutter=10px;
ods region;/*top left*/
title "high/low";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="Intel"));
series x=date y=high;
series x=date y=low;
run;
ods region;/*top right*/
title "close";/*the graph title*/
proc sgplot data=sashelp.stocks(where=(stock="Intel"));
series x=date y=close;
run;

ods layout end;
ods layout gridded columns=1;

ods region;
proc print data=sashelp.stocks(where=(stock="Intel") obs=3) ;
run;
title;
ods layout end;


ods _all_ close;
Ask a Question
Discussion stats
  • 3 replies
  • 251 views
  • 0 likes
  • 3 in conversation