LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2006, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 31 May 2006 13:19:57 -0700
Reply-To:     "Pardee, Roy" <pardee.r@GHC.ORG>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Pardee, Roy" <pardee.r@GHC.ORG>
Subject:      Re: Read/Write Microsoft Word document
Comments: To: "data _null_;" <datanull@GMAIL.COM>
Content-Type: text/plain; charset="US-ASCII"

We had a guy here come up w/a fairly Rube-Goldbergian thing using winword's mail merge feature. He defined merge fields in a word document that referred to a text file, and then changed the contents of the text file w/sas to "update" the word doc.

It worked well for the time his group needed it AFAIK...

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of data _null_; Sent: Wednesday, May 31, 2006 12:30 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Read/Write Microsoft Word document

I think your method will "break" your WORD document. You my be able to accomplish this using SAS via DDE. I don't have an example but there are many SUGI papers and other SAS-L related discussions that should be helpful.

You should be able to use SAS to execute a find/change etc. through DDE, I do this with SAS DDE to EXCEL but have not tried it with WORD.

I suspect there are more modern methods, that would be rather simple. Others will be more helpful. Search the archives while you wait.

On 5/31/06, compilsys <pmaradan@compilsys.com> wrote: > Hi, > Does anyone knows how to read a Microsoft Word document (not RTF) and > write into a new one with some string modified... > > I tried : > > data _null_; > infile 'c:\mydocument.doc' recfm=n length=len _infile_=tmp; > input; > if index(tmp,'stringtomodify') > 0 then > tmp=tranwrd(tmp,'stringtomodify','stringmodified'); > put tmp $varying32767. len; > run; > > ...but does'nt work. > I choose WORD document because same RTF document is ~20MB instead of > ~350K... > thanks folks > Pascal >


Back to: Top of message | Previous page | Main SAS-L page