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?
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;
I am a little concerned with this bit:
FILE="&path./&YYYYMM.\documents/testing.pptx"
why do you mix / and \ in the file name?
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.
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;
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.