Data visualization with SAS programming

SAS ODS Graphics to MS Word Advice Wanted

Accepted Solution Solved
Reply
Trusted Advisor
Posts: 1,189
Accepted Solution

SAS ODS Graphics to MS Word Advice Wanted

Looking for general best practices advice (or papers) on  formats/options to use for outputing ODS Graphics in a format that will nicely cut-and-paste into MS Word.  Big picture is I will end up writing a stored process that makes some graphs, and usually they are just for viewing in a browser, but sometimes users want to copy one or two into a  Word report. 

 

I'm using 9.4M3 on linux server.  Graphs will have some semi-transparent layers.

 

Seems like the most popular formats for Word would be EMF or PNG.  Since I suspect users will want to adjust the size of the charts, my initial thought is use ODS RTF with image_fmt=EMF, since it's a vector plot.  But from browsing online, looks like many people just use image_fmt=png for Word?

 

I had hoped using image_fmt=EMF might make the image editable in MS Word.  We've got Office 2010 on Win 7 PCs, and when I open a file in Word and use Edit->Picture to covert it into a MS Drawing Object, it disappears.  This isn't the end of the world, however, my memory is editing in Word always made things a little bit wonky anyway.

 

I think users will likely want to edit titles/footnotes when they insert them into a report, so my thought is to use RTF options: bodytitle nogtitle nogfootnote. 

 

I haven't played yet with ODS Powerpoint, but looks like that uses PNG by default.

 

I suppose another option is to just stick with ODS HTML (which is using image_fmt=PNG), and just increase the DPI and tell users to use the browser to download any images they want.  But since I don't want the titles/footnotes in the image, they would be lost.

 

Current sample code is:

 

footnote1 "My Footnote" ;

title1 "My EMF Plot" ;
ods graphics/ reset=all
              border=off
              width=6.0 in
              imagefmt=EMF
;

ods rtf file="&outdir/EMF.rtf" bodytitle nogtitle nogfootnote style=statistical;
proc sgplot data=sashelp.prdsale ;
  vbox actual / category=month ;
run ;
ods rtf close ;
title1;


title1 "My PNG Plot" ;
ods graphics/ reset=all
              border=off
              width=6.0 in
              imagefmt=png              
;

ods rtf file="&outdir/PNG.rtf" image_dpi=200 bodytitle nogtitle nogfootnote style=statistical;
proc sgplot data=sashelp.prdsale ;
  vbox actual / category=month ;
run ;
ods rtf close ;

title1 ;
footnote1 ;

 

Thanks for recommendations.  I've been doing a lot of ODS HTML and PDF for the past several years, it's been a good while since I've really thought about output for MS Word.

 

--Q.


Accepted Solutions
Solution
2 weeks ago
SAS Super FREQ
Posts: 1,061

Re: SAS ODS Graphics to MS Word Advice Wanted

[ Edited ]

OutputFmt=EMF is supported.  However, RTF files are bigger than similar DOCX files.  The EMF output is is vector, and scalable.  But it is not always the best looking.  Some transparency and image features are not fully supported in EMF, and so you get a PNG output anyway.

 

I prefer PNG if file size and large magnification is not an issue.  I normally render my graphs for inclusion in books etc at 300 dpi.  You can go higher (600dpi), but any higher may cause "out of memory" issues.   These can be addressed by increasing Java memory.  I suggest rendering the graph at the size expected in the document.  That will ensure text is readable.  If you want to place a graph in 4" width of the page, render it with WIDTH=4in, DPI=300 or higher.

 

View solution in original post


All Replies
Solution
2 weeks ago
SAS Super FREQ
Posts: 1,061

Re: SAS ODS Graphics to MS Word Advice Wanted

[ Edited ]

OutputFmt=EMF is supported.  However, RTF files are bigger than similar DOCX files.  The EMF output is is vector, and scalable.  But it is not always the best looking.  Some transparency and image features are not fully supported in EMF, and so you get a PNG output anyway.

 

I prefer PNG if file size and large magnification is not an issue.  I normally render my graphs for inclusion in books etc at 300 dpi.  You can go higher (600dpi), but any higher may cause "out of memory" issues.   These can be addressed by increasing Java memory.  I suggest rendering the graph at the size expected in the document.  That will ensure text is readable.  If you want to place a graph in 4" width of the page, render it with WIDTH=4in, DPI=300 or higher.

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 54 views
  • 1 like
  • 2 in conversation