BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ckreisl1
Fluorite | Level 6

Hello,

 

I am trying to create a PowerPoint presentation with a custom layout for one of the slides (2 rows, 2 columns).

 

For the custom layout I have been trying to use ODS Layout Gridded, but have not been able to get it to show up on the slide correctly. It seems that SAS is trying to add the content of the Gridded layout slide to the previous slide.

 

Any suggestions? Below is a simplified version of the code I am working with, and it has the same effect. I am using SAS EG 6.1.

 

Thanks,

Craig

 

proc sql;
   create table cars as 
   select Make,
          sum(MSRP) as TotMSRP format=dollar10.
   from sashelp.cars
   group by Make;
quit;

ods powerpoint file="cars.pptx" layout=_null_;

/*Slide 1 with text in bottom left corner.*/
proc odstext;
   p "";
   p "";
   p "";
   p "";
   p "";
   p "";
   p "";
   p "";
   p "Daily Report" / style={fontweight=bold fontsize=36pt};
   p "%sYsFunc(putn(%sYsFunc(today()),WeekDate.))" / style={fontweight=bold fontsize=20pt};
run;

/*Slide 2 with a gridded layout*/
ods layout gridded rows=2 columns=2;
ods graphics / width=8in height=3in;

ods region row=1 column_span=2;
proc sgplot data = cars;
   vbar Make / response=TotMSRP  
      nostatlabel name="bar" nooutline;
   yaxis min=0 offsetmin=0 values=(0 to 1650000 by 150000) grid
     label="Total MSRP";
   xaxis display=(noticks nolabel);
run;

ods region row=2 column=1;
proc odslist;
   item;
     p "Car Makes" / style={fontweight=bold fontsize=10pt};
	 list;
	   item "Acura" / style={fontsize=10pt};
	   item "Audi" / style={fontsize=10pt};
	   item "BMW" / style={fontsize=10pt};
	   item "Buick" / style={fontsize=10pt};
	   item "ETC" / style={fontsize=10pt};
	 end;
   end;
run; 

ods region row=2 column=2;
proc odslist;
   item;
     p "Car Makes" / style={fontweight=bold fontsize=10pt};
	 list;
	   item "Acura" / style={fontsize=10pt};
	   item "Audi" / style={fontsize=10pt};
	   item "BMW" / style={fontsize=10pt};
	   item "Buick" / style={fontsize=10pt};
	   item "ETC" / style={fontsize=10pt};
	 end;
   end;
run; 
ods layout end;
ods powerpoint close;

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ckreisl1
Fluorite | Level 6

Thanks for the responses! I checked with tech support and Jane set me along the right path.

 

This way her reply:

 

"...It is possible to create the output that you want.  There are a couple of things to note.  

 

ODS PowerPoint will not start a second slide until the first one is full.  Sometimes this means a graph is placed on the first slide but it is really small.  In that circumstance you have to force a new slide with a DATA _NULL_ step -- I have included that step in the attached code.  

 

Another thing is that column_span and row_span do not work as well in PowerPoint as they do in PDF or HTML.  Therefore, I recommend that you create a separate layout container for the graph that you want to span two columns..."

 

Below is the revised code Jane from tech support sent me:

 

proc sql;
   create table cars as 
   select Make,
          sum(MSRP) as TotMSRP format=dollar10.
   from sashelp.cars
   group by Make;
quit;

ods _all_ close;
title;
ods powerpoint file='test.pptx';
/*Slide 1 with text in bottom left corner.*/
proc odstext;
   p "";
   p "";
   p "";
   p "";
   p "";
   p "";
   p "";
   p "";
   p "Daily Report" / style={fontweight=bold fontsize=36pt};
   p "%sYsFunc(putn(%sYsFunc(today()),WeekDate.))" / style={fontweight=bold fontsize=20pt};
run;

/*insert slide break*/
data _null_;
  dcl odsout obj();
run;


/*Slide 2 with a gridded layout*/
ods layout gridded;
	ods graphics / width=8in height=3in;
	ods region ;
	proc sgplot data = cars;
	   vbar Make / response=TotMSRP  
	      nostatlabel name="bar" nooutline;
	   yaxis min=0 offsetmin=0 values=(0 to 1650000 by 150000) grid
	     label="Total MSRP";
	   xaxis display=(noticks nolabel);
	run;
ods layout end;

ods layout gridded columns=2;
	ods region;
	proc odslist;
	   item;
	     p "Car Makes" / style={fontweight=bold fontsize=10pt};
		 list;
		   item "Acura" / style={fontsize=10pt};
		   item "Audi" / style={fontsize=10pt};
		   item "BMW" / style={fontsize=10pt};
		   item "Buick" / style={fontsize=10pt};
		   item "ETC" / style={fontsize=10pt};
		 end;
	   end;
	run; 

	ods region;
	proc odslist;
	   item;
	     p "Car Makes" / style={fontweight=bold fontsize=10pt};
		 list;
		   item "Acura" / style={fontsize=10pt};
		   item "Audi" / style={fontsize=10pt};
		   item "BMW" / style={fontsize=10pt};
		   item "Buick" / style={fontsize=10pt};
		   item "ETC" / style={fontsize=10pt};
		 end;
	   end;
	run; 
ods layout end;
ods powerpoint close;

 

 

This works well. One thing that I did notice when I tried to apply this solution to my actual working problem is that it did not work perfectly when trying to create back-to-back slides with custom layouts when utilizing Title statements. Creating one slide with titles and footnotes worked fine. But when I tried to add another custom layout slide after the first custom slide, the second slide was basically overwritten on the first. I found that when I removed the Title statements from each of the slides, that the slides were created correctly, one after another (obviously without titles though). I am using the NOGTITLE and NOGFOOTNOTE options on the ODS PowerPoint statement. I guess this is something that I will just have to continue to look into and figure out what is causing the issue.

View solution in original post

5 REPLIES 5
Cynthia_sas
SAS Super FREQ
Hi:
This Tech Support note http://support.sas.com/kb/50/486.html indicates that ODS POWERPOINT only supports 3 types of layout. I note that to get the tables side by side, they use layout=twocontent and they do NOT use ODS REGION.

If you look at the doc for how ODS REGION is used with ODS LAYOUT GRIDDED, the doc says that this form of the ODS REGION statement will only work with HTML, PRINTER (PDF) and SASReport destinations -- it does not indicate that ODS REGION works with ODS POWERPOINT:
http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/viewer.htm#p0g1r9d5mqtuezn1g3sv...

My suggestion is that you either work with Tech Support or start with the example shown in the Tech Support note. I would not expect any of the code you have to generate your desired results, given what's in the documentation.

cynthia
ckreisl1
Fluorite | Level 6
Thanks for the reply!
I did notice on the doc for ODS Region that it did not mention PowerPoint. On the doc from ODS Gridded Layout, it does though.. "Gridded layout is supported for HTML and PRINTER destinations (PDF, PS, and PCL). It is also supported for the ODS destination for PowerPoint." (http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/viewer.htm#p06ji2uhvayhq5n1eik2...

Also, this paper (http://wuss.org/Proceedings13/143_Paper.pdf) mentions that you can use ODS Gridded Layout.
Cynthia_sas
SAS Super FREQ
Hi: You have to check with Tech Support on this ODS REGION and ODS LAYOUT might not work together in ODS POWERPOINT the way they work together in PDF or HTML. I believe the way you use Gridded Layout with PowerPoint is through the LAYOUT= option. Gridded Layout refers to the ODS LAYOUT statement specifically. Gridded Layout does not necessarily imply the use of the ODS REGION statement is automatically supported. Also, notice that there are not any ODS REGION examples shown in the WUSS paper you linked to.

cynthia
ckreisl1
Fluorite | Level 6

Thanks for the responses! I checked with tech support and Jane set me along the right path.

 

This way her reply:

 

"...It is possible to create the output that you want.  There are a couple of things to note.  

 

ODS PowerPoint will not start a second slide until the first one is full.  Sometimes this means a graph is placed on the first slide but it is really small.  In that circumstance you have to force a new slide with a DATA _NULL_ step -- I have included that step in the attached code.  

 

Another thing is that column_span and row_span do not work as well in PowerPoint as they do in PDF or HTML.  Therefore, I recommend that you create a separate layout container for the graph that you want to span two columns..."

 

Below is the revised code Jane from tech support sent me:

 

proc sql;
   create table cars as 
   select Make,
          sum(MSRP) as TotMSRP format=dollar10.
   from sashelp.cars
   group by Make;
quit;

ods _all_ close;
title;
ods powerpoint file='test.pptx';
/*Slide 1 with text in bottom left corner.*/
proc odstext;
   p "";
   p "";
   p "";
   p "";
   p "";
   p "";
   p "";
   p "";
   p "Daily Report" / style={fontweight=bold fontsize=36pt};
   p "%sYsFunc(putn(%sYsFunc(today()),WeekDate.))" / style={fontweight=bold fontsize=20pt};
run;

/*insert slide break*/
data _null_;
  dcl odsout obj();
run;


/*Slide 2 with a gridded layout*/
ods layout gridded;
	ods graphics / width=8in height=3in;
	ods region ;
	proc sgplot data = cars;
	   vbar Make / response=TotMSRP  
	      nostatlabel name="bar" nooutline;
	   yaxis min=0 offsetmin=0 values=(0 to 1650000 by 150000) grid
	     label="Total MSRP";
	   xaxis display=(noticks nolabel);
	run;
ods layout end;

ods layout gridded columns=2;
	ods region;
	proc odslist;
	   item;
	     p "Car Makes" / style={fontweight=bold fontsize=10pt};
		 list;
		   item "Acura" / style={fontsize=10pt};
		   item "Audi" / style={fontsize=10pt};
		   item "BMW" / style={fontsize=10pt};
		   item "Buick" / style={fontsize=10pt};
		   item "ETC" / style={fontsize=10pt};
		 end;
	   end;
	run; 

	ods region;
	proc odslist;
	   item;
	     p "Car Makes" / style={fontweight=bold fontsize=10pt};
		 list;
		   item "Acura" / style={fontsize=10pt};
		   item "Audi" / style={fontsize=10pt};
		   item "BMW" / style={fontsize=10pt};
		   item "Buick" / style={fontsize=10pt};
		   item "ETC" / style={fontsize=10pt};
		 end;
	   end;
	run; 
ods layout end;
ods powerpoint close;

 

 

This works well. One thing that I did notice when I tried to apply this solution to my actual working problem is that it did not work perfectly when trying to create back-to-back slides with custom layouts when utilizing Title statements. Creating one slide with titles and footnotes worked fine. But when I tried to add another custom layout slide after the first custom slide, the second slide was basically overwritten on the first. I found that when I removed the Title statements from each of the slides, that the slides were created correctly, one after another (obviously without titles though). I am using the NOGTITLE and NOGFOOTNOTE options on the ODS PowerPoint statement. I guess this is something that I will just have to continue to look into and figure out what is causing the issue.

BLarson
Obsidian | Level 7

Did you ever find a solution for inclusion of Titles?  I had the same exact issue, I removed the Titles and it now works fine.  But wondering if I can get them back in there?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2269 views
  • 1 like
  • 3 in conversation