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;
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.