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!
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.
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.
Personally, I always found ungrouping an image shifted things just enough that I decided to avoid it as much as possible.
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.
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.
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.
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.
@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.
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.