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

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!

1 ACCEPTED SOLUTION

Accepted Solutions
kalbo
Obsidian | Level 7

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. 

View solution in original post

9 REPLIES 9
Quentin
Super User

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.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
kalbo
Obsidian | Level 7

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.

 

 

Reeza
Super User

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.

Quentin
Super User

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 ! 🙂

 

 

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.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
kalbo
Obsidian | Level 7

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.

Reeza
Super User

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

Quentin
Super User
@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.
BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
kalbo
Obsidian | Level 7

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. 

Quentin
Super User
Thanks for posting the tech support response, @kalbo. I suggest marking that as the accepted solution.
BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

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
  • 9 replies
  • 2937 views
  • 6 likes
  • 3 in conversation