SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

Paste graph to specific location in Word Document

Reply
Occasional Contributor
Posts: 9

Paste graph to specific location in Word Document

Hello,

 

I am creating customized reports for my clients in Microsoft Word. I have to insert a SAS-created graph into each of the reports, in the same location in each report. Is there a method of automating this copy and paste process using SAS? Can I use SAS DDE for this? Any code would be appreciated.

 

Many thanks in advance.

 

 

Esteemed Advisor
Esteemed Advisor
Posts: 6,726

Re: Paste graph to specific location in Word Document

Hi,

 

Well, DDE is very old, wouldn't recommend it.  You can setup your Word document to use file references - i.e. have the picture saved in a separate file, that is loaded at open of the Word document.  

http://www.labnol.org/software/insert-images-in-word-documents/8144/

 

This would be the best method to do this - or move to a reporting platform.  Actually embedding the file itself each time would be quite complex.  SAS doesn't know the setup of your document, so it would need to call VBA, which would then process and update as needed, but thats out of scope for this forum.

 

Occasional Contributor
Posts: 9

Re: Paste graph to specific location in Word Document

Thank you for your quick reply. The graph that I need to paste into each document is created in SAS. I know that ODS code can be used to output and save graphs, but I'm not sure which file types are compatible with Word. Sorry, I'm quite a newbie to all of this Smiley Happy.

 

Can you please suggest what ODS code I can use to output a graph as a picture file that can be readily embedded into my document? I plan on using the "Insert and Link" method described in the article that you sent to me.

 

Thanks!!

Grand Advisor
Posts: 16,350

Re: Paste graph to specific location in Word Document

You want to create a PNG, JPG or SVG file instead.

You can specify the format on the ODS GRAPHICS statement.

 

http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/viewer.htm#p0kroq43yu0lspn16hk1...

 

 

 

 

Occasional Contributor
Posts: 9

Re: Paste graph to specific location in Word Document

Great, thanks!

Post a Question
Discussion Stats
  • 4 replies
  • 184 views
  • 1 like
  • 3 in conversation