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.
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;
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.
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.
put '"Description"="Enhanced Metafile Format"';
put '"Metafile Type"="DUAL"';
proc registry import="&workdir./emf94.sasxreg";
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)
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;
ods rtf close;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.