- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
GOAL: Use PROC GPLOT to create a graph that can be copied and pasted into MS Word with editable properties.
BACKGROUND: I used SAS 9.3 that created a PROC GPLOT graph in the "Results" which could be simply copied and pasted into MS Word 2010. The copied graphic in Word appeared to contain data since I could move my cursor and see data points along my graph plus click the graph that brought up various graph formatting options to edit lines, fonts, graph characteristics etc... it was great.
PROBLEM: I upgraded to SAS 9.4. I ran the same program but the copied graphic now pastes into Word 2010 like a regular image file and selection of the graphic only allows the "usual" right click file options in Word. What happened to this wonderful feature?
I tried googling and found .EMF goptions and other advice but none seemed to work.
Am I missing the wrong Google search keyword or is .EMF not the problem when SAS was updated to version 9.4?
Advice I tried to follow included the following although PROC SGPLOT is not being used.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Re: Creating editable (ungroupable) graphs in powerpoint 2010
Options
Posted in reply to Quentin
2017-08-28 12:48 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I have tried that suggestion hoping that would work. I did not change anything to the code including "pathname" in the snippet, "%let workdir=%trim(%sysfunc(pathname(work)));"
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yeah, you're not supposed to change anything. That does work for me.
So to clarify, you ran the modification above, and tried an EMF output format and it doesn't work? It does with SGPLOT for me.
ods graphics / imagefmt=emf;
ods rtf file='C:\_localdata\temp\demo.rtf';
proc sgplot data=sashelp.class;
scatter x=height y=weight / group=sex;
run;
ods rtf close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc gplot data=Stackeddata;
PLOT (CumArea_pct_1-CumArea_pct_&BANDNUM.) * xvar_days/OVERLAY AREAS=&BANDNUM. legend=legend1
NOFRAME HAXIS= axis1 VAXIS=axis2 VREF=50 cv=black HREF=&call3min. &call3max. lh=3 ch=lightgrey ;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This also works for me:
ods rtf file='C:\_localdata\temp\demo2.rtf' device=emf;
proc gplot data=sashelp.class;
plot height*weight;
run;
ods rtf close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
ods rtf file='C:\_localdata\temp\demo2.rtf' device=emf;
proc gplot data=sashelp.class;
plot height*weight;
run;
ods rtf close;
It creates the demo2.rtf file which I opened in Word. Again, it creates a graphic but a right click does not allow all the various editing. It does show "Edit Picture" as an option once I right click on it. This brings up a dialogue box stating "This is an imported picture, not a group. Do you want to convert it to a Microsoft Office drawing object?" Clicking yes causes the Word document to go blank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So clicking yes, then causes me to have the graph and be able to format points. I'm using SAS 9.4 TS1M5 and have run that code above with no errors to modify the EMF portion. If you have the same set up you may want to contact SAS tech support.
FYI - a workaround is to use the ODS Graphics Designer which includes all of the features you're looking for, but you do need to use SGPLOT I believe. It does allow for a lot of customization though.
EDIT: And using Office 2016.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
"WARNING: Unsupported device 'SASEMF' for TAGSETS.SASREPORT13(EGSR) destination. Using default device 'PNG'.
Is there another setting or option needed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I also attempted this technique and it did not work in the RTF destination. When I click to edit the graph in word it disappears from the page. The code I used is shown below on 9.4 M7.
%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"="DUAL"';
run;
proc registry import="&workdir./emf94.sasxreg";
run;
ods graphics/ height = 6in width = 10.5in attrpriority = none outputfmt=emf;
ods rtf file = ".\Documents\Reports\ test emf.rtf" device = emf;
PROC SGPLOT DATA = ADVA2;
styleattrs datasymbols= (CircleFilled CircleFilled)
datacontrastcolors=(green orange)
datalinepatterns= (dash solid);
SERIES X = WEEK Y = letters /LINEATTRS=(thickness = 2pt) GROUP = RPECAT NAME = 'S' groupdisplay = cluster ;
SCATTER X = WEEK Y = letters /YERRORUPPER = LCL YERRORLOWER=UCL GROUP = RPECAT
GROUPDISPLAY = CLUSTER ERRORBARATTRS = (THICKNESS = 2pt)
/*MARKERFILLATTRS = (size = 3pt)*/ markerattrs = (size = 8pt );
KEYLEGEND 'S' / noborder valueattrs = (size = 8pt) ;
XAXIS LABEL = "Week" values = (-8 1 5 8 12 24 36 48 72 96) grid labelattrs=(size = 8pt) valueattrs=(size = 8pt);
yaxis label = "Mean BCVA (Letters)" grid values = (-20 to 100 by 10) grid valueshint labelattrs=(size = 8pt) valueattrs=(size = 8pt);
label week ="Week" letters= "Mean" ucl="95% UCL" lcl = "95% LCL" recs = 'n';
xaxistable recs / x = week classorder = ascending class = rpecat valueattrs = (size = 8pt) colorgroup = rpecat;
RUN;
ods rtf close;
;