BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8
I have 10 word documents (for eg) in a folder. Each doc has multiple pages in it.
I want page 1 only of every single word doc and combine them into a new word doc(final.doc).


So, final.doc should have 10 pages:

page1 of doc1 + page1 of doc2 + page1 of doc3 +...... page1 of doc 10.

Is there a automated way to do this ?
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
Word documents are stored in a proprietary format according to whichever version of Microsoft Office and Word you are using. SAS has an engine for reading Excel proprietary format, but does not have any method for reading a proprietary Word document. This paper does show an interesting way to read Microsoft Office 2003 Word XML -- http://www2.sas.com/proceedings/sugi31/019-31.pdf but the focus of the paper is how to get the information out of the XML and into a SAS dataset, which is not what you describe.

Even if you saved the 10 Word documents in RTF format, it would be a hard DATA step program to write in order to parse all the RTF control strings in order to pick out just the first page of each document.

How were the Word documents originally created?? If they were originally RTF files created with ODS, you might be able to rerun the SAS job that created the RTF files, but limit the number of obs to only what would fit on page 1 of each output file.

Is this something you might try to do with a Word macro or VB Script?

cynthia

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 711 views
  • 0 likes
  • 2 in conversation