BookmarkSubscribeRSS Feed
JEChurchill
Calcite | Level 5

I am importing information from an excel file to do a document merge into a letter using a letterhead template.  Then I want to export that letter into several separate .RTF files to have separate letters to send out via email.  I have been able to create a merged master file on letterhead containing all of the pages using all of the records from the excel file (which I put into a multi page .RTF file called MEMO.rtf):

 

filename word DDE 'Winword|system' lrecl=1000;
 options noxwait noxsync; 

filename watermrk "N:\Letterhead.doc";
 %let rc=%sysfunc(system(start winword));

 data _null_;
 file word;
 put '[FileOpen.Name = "' "N:\Letterhead.doc" '"]';
 put '[Insertfile .Name ="' "N:\MEMO.rtf" '" ]';
 put '[FilePageSetup '
 '.Orientation =0,'
 '.PageWidth ="8.5 in ",'
 '.PageHeight ="11.5 in ",'
 '.TopMargin ="1 in ",'
 '.BottomMargin ="1 in ",'
 '.LeftMargin ="1 in ",'
 '.RightMargin =1 in "]';
run;

I am getting stuck at how to parse out the multiple records into multiple RTF files. help!

2 REPLIES 2
ballardw
Super User

To me this sounds like you really want a Microsoft help site to work with MAILMERGE.

SASKiwi
PROC Star

I'd suggest you explore the SAS ODS RTF facility to write your documents instead of coding it yourself: https://documentation.sas.com/?docsetId=odsug&docsetTarget=p1vvsv8ucnjzjnn1wq5wrlp74mdb.htm&docsetVe...

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
  • 2 replies
  • 437 views
  • 0 likes
  • 3 in conversation