Data visualization with SAS programming

Problem embedding a SAS graph in a Microsoft Word document that will ultimately be PDF

Reply
Occasional Contributor
Posts: 15

Problem embedding a SAS graph in a Microsoft Word document that will ultimately be PDF

I’m using SAS ODS graphics to generate EMF vector graphs for embedding in a Word document (a statistics textbook). I import the graphs into Word by copying the EMF graphs from a SAS-generated RTF document into my working document.

Ultimately, the Word document will be converted into a PDF document for publication. The easiest way to do that is to use the “save as PDF” function in Word. But if I use the Word “save as PDF” function to generate a PDF document from my Word document then, curiously, the fitted lines on graphs in the PDF document are always much too thin, much thinner than when they are rendered in raw SAS output or rendered in Word.

I can correct this problem by specifying a greater thickness for the fitted lines, perhaps ten times the default thickness. But doing that creates a secondary problem. That is, the SAS graph-generating routines sometimes make unnecessary adjustments to the graphs to correct for what they may think are very thick lines. And the adjustments decrease the quality of the graphs (by causing OFFSETMAX and OFFSETMIN to be too large on some graphs).

I’ve attached a sample program to illustrate the thickness and OFFSET problems.

Can you suggest how to get around these problems? That is, is there some way that I get vector-based graphs from SAS in a PDF file out of Word with fitted lines of proper thickness and without the OFFSET problems?

Thanks for your help,

Don Macnaughton

Attachment
SAS Super FREQ
Posts: 925

Re: Problem embedding a SAS graph in a Microsoft Word document that will ultimately be PDF

Try using the ODS LISTING destination to generate the standalone EMF files and embed them into your Word document. The some information might be getting lost in the extra "hop" through the clipboard.

ods _all_ close;

ods listing;

ods graphics / imagefmt=emf;

/* Your code */

Occasional Contributor
Posts: 15

Re: Problem embedding a SAS graph in a Microsoft Word document that will ultimately be PDF

Dan,


Thank you.  That's a good idea.  Unfortunately, if I insert the ODS LISTING graphs from the EMF files in a Word document and then convert the document to PDF, the same problems recur.


That is, the thickness of the fitted line is quite different if you compare the Word document with the PDF document created by the Word PDF writer.  And the OFFSETMAX and OFFSETMIN are inappropriately adjusted on a graph if I make the fitted line thick enough to render properly in a PDF file created by the Word PDF writer. And in the version of the document created by the Adobe PDF writer add-in in Word all the text is missing.


The adjustments SAS makes to OFFSETMAX and OFFSETMIN make the graphs look somewhat amateurish because space on the graphs is being wasted.


I've attached the SAS program I used to perform the test.


Don Macnaughton

Attachment
Ask a Question
Discussion stats
  • 2 replies
  • 392 views
  • 0 likes
  • 2 in conversation