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...

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 383 views
  • 0 likes
  • 3 in conversation