Data visualization with SAS programming

Creating editable (ungroupable) graphs in powerpoint 2010

Reply
New Contributor
Posts: 4

Creating editable (ungroupable) graphs in powerpoint 2010

Hi all experts out there.

 

I have been creating graphs using proc gplot and ods rtf destination for a while. This would create output in word (with graphs embedded as .png files). Im currently using device=png option.

 

To edit the graphs, titles, footnotes etc I would simply copy and paste each graph into Powerpoint 2010 then ungroup. This enabled me to change most aspects of each graph.

 

However I have upgraded to SAS 9.4 recently and now when I select "Ungroup" in powerpoint the graph simply disappears and I'm left with a blank slide!

 

If anyone could help that would be great. I did try ODS powerpoint by the way but that simply added graphs as .png and then had the same issue when ungrouping .

 

Your help is much appreciated!

PROC Star
Posts: 1,290

Re: Creating editable (ungroupable) graphs in powerpoint 2010

I don't think .png images can be ungrouped.  Are you sure you had .png images before? 

 

I think you neet a vector format to allow ungrouping.  This post suggests WMF or EPS.  I think SAS can make those, and some others.

 

See https://answers.microsoft.com/en-us/msoffice/forum/msoffice_powerpoint-mso_winother/grouping-and-ung...

 

Personally, I always found ungrouping an image shifted things just enough that I decided to avoid it as much as possible.

New Contributor
Posts: 4

Re: Creating editable (ungroupable) graphs in powerpoint 2010

Thanks Quentin.

 

What I did was create rtf output, then copy and paste the graph into Powerpoint. Then ungroup there. The graphs created were .png but then there is a copy and paste step to powerpoint. Maybe that did a conversion Im not sure.

 

 

Super User
Posts: 19,058

Re: Creating editable (ungroupable) graphs in powerpoint 2010

SAS 9.4 can output directly to PPTX now as well. 

SGPLOT is also available so if you have some time, I'd consider seeing if the graphs can be automated entirely in SAS.

PROC Star
Posts: 1,290

Re: Creating editable (ungroupable) graphs in powerpoint 2010

I played a bit.  Both RTF and POWERPOINT destinations support EMF, which is a vector format.

 

I tested using PC SAS 9.4M4 and Office 2010.  In both Word and Powerpoint, when I ungrouped or edited the image, it disappeared.

 

ods graphics/imagefmt=emf;

ods powerpoint file="d:\junk\myppt.pptx";
ods rtf file="d:\junk\myrtf.rtf";
proc sgplot data=sashelp.class;
  scatter x=height y=weight;
run;
ods rtf close;
ods powerpoint close;

I suppose could be a word bug, a SAS bug in the EMF file, or just an incompatibility as my office version is 7 years old (like yours ! Smiley Happy

 

 

I wonder if someone with a newer version of office could try above code and see if editing/ungrouping works?  Googling for microsoft emf image disappears turned up a number of hits, but I didn't see anything obvious.

 

While I've been sticking with mostly with .png recentlly, for some of what I do it would be nice for users to be able to edit a graph after I produce it.  So this seems like a worthwhile question to me.

New Contributor
Posts: 4

Re: Creating editable (ungroupable) graphs in powerpoint 2010

Thanks for posting that code.

 

The issue didnt occur previously when creating graphs using proc gplot in SAS 9.1. However, since the upgrade to 9.4 the issue has arisen. Same version of office was used (2010).

 

Perhaps there is a default setting in 9.4 that has been tweaked which creates this issue.

 

Also I dont believe there is a workaround using ODS POWERPOINT as we are in the same situation of the graph disappearing when we want to ungroup it.

 

Thanks everyone.

Super User
Posts: 19,058

Re: Creating editable (ungroupable) graphs in powerpoint 2010


kalbo wrote:

 

Also I dont believe there is a workaround using ODS POWERPOINT as we are in the same situation of the graph disappearing when we want to ungroup it.

 


 

It was a suggestion to fully workaround and not separate the components in the first place. ODS graphics are different than the G procedures you've been using and have come quite far in terms of being able to customize a graph to be suitable for publications. There seems to be a set of people who simply believe SAS graphs can never be good enough regardless but that reputation is not warranted in the last few years of changes. The graphs created can included animated graphs that are gifs that work inside powerpoint. 

PROC Star
Posts: 1,290

Re: Creating editable (ungroupable) graphs in powerpoint 2010

@kalbo if you don't get a solution from here, I'd suggest sending it in to tech support.

If you still have 9.1 available, you could try running my sample code in 9.1 and 9.4, compare the RTF files to see how they differ, and confirm that the version produced in 9.1 can be ungrouped in Office 2010. Might be interesting.
New Contributor
Posts: 4

Re: Creating editable (ungroupable) graphs in powerpoint 2010

Here's the reply from SAS. I have yet to try it though.

 

This is a known issue with SAS 9.4.  The problem is due to a change to our EMF support that R&D made for 9.4.  To see if this circumvents the problem, modify your SAS code by adding the following code to the top of your existing code:
 
%let workdir=%trim(%sysfunc(pathname(work)));
 
data _null_;
   file "&workdir./emf94.sasxreg";
   put '[CORE\PRINTING\PRINTERS\EMF\ADVANCED]';
   put '"Description"="Enhanced Metafile Format"';
   put '"Metafile Type"="EMF"';
   put '"Vector Alpha"=int:0';
   put '"Image 32"=int:1';
run;
 
/* Import the file */
proc registry import="&workdir./emf94.sasxreg";
run;
 
The code above modifies the SAS registry in your SASUSER directory and changes the default EMF support back to what it was with 9.3.  If the code above works for you, you should only have to submit the code above once to SAS.  The change should stay in effect for subsequent SAS sessions. 

PROC Star
Posts: 1,290

Re: Creating editable (ungroupable) graphs in powerpoint 2010

Thanks for posting the tech support response, @kalbo. I suggest marking that as the accepted solution.
Ask a Question
Discussion stats
  • 9 replies
  • 228 views
  • 4 likes
  • 3 in conversation