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

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 935 views
  • 0 likes
  • 3 in conversation