Hello,
I created a panel plot using PROC SGPANEL and want to insert it as scalable vector graphic into a Microsoft Word file for a research paper. I initially exported and saved it as a svg file using the ODS imagefmt=svg statement. The image was saved as an HTML file, and looked great when I opened and viewed it in a web browser. However, when I tried to insert it into the Word document, I did not see the file in the folder I saved it to when I tried to find it using the Word Insert function. I found that I can also save the image as an EMF file and insert that into Word. If so, I am having trouble exporting and saving the image from PROC SGPANEL using the outputfmt=emf option. I am able to get the code to run without errors, but it is not outputting and saving the image. This is the code I ran:
ods _all_ close;
ods graphics on/reset outputfmt=emf;
ods listing file='sas_directory_path/imagename.emf';
ods graphics / noborder;
title1 height=1.5 justify=center "Title" ;
proc sgpanel data=dataset noautolegend;
panelby label / layout=rowlattice onepanel noheaderborder sort=data
novarname HEADERBACKCOLOR=white HEADERATTRS=(Size=12 Weight=Bold) proportional;
highlow x=input low=min high=max/ highcap=none lowcap=none type=bar fillattrs=(color=lightblue )
lineattrs=(color=darkgray thickness=1) barwidth=.5;
rowaxis label="Stats By Model" grid labelattrs=(size=12 weight=bold) ;
scatter x=input y=mean/ markerattrs=(color=darkblue size=4 symbol=diamondfilled);
colaxis display=(nolabel) discreteorder=data;
run;
title1 ;
ods output 'sas_directory_path/imagename.emf';
ods listing close;
To insert the SAS generated image into Word, I can only save the image as an EMF file, correct? If not, what is the best way to save an svg image that can be inserted into Microsoft Word?
If you have SAS version 9.4m7 or greater, the ODS WORD destination supports embedded SVG output. If you have that version available, I would generate the output using ODS WORD with OUTPUTFMT=SVG, then see if you can copy it from that document to your research paper. Let me know if that works for you.
If you have SAS version 9.4m7 or greater, the ODS WORD destination supports embedded SVG output. If you have that version available, I would generate the output using ODS WORD with OUTPUTFMT=SVG, then see if you can copy it from that document to your research paper. Let me know if that works for you.
After changing the suffix to .docx in the file= statement, it worked! I was able to successfully paste a svg image to a Word document.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.