The SAS Output Delivery System and reporting techniques

Mail merge randomization forms

Occasional Contributor
Posts: 17

Mail merge randomization forms

Dear All,

I need to make a mail-merge document which is a randomization form for a study (one page per randomization number). Each page has the company logo at the top, three centered title lines, a box with the randomization number and treatment assignment and some fields that need to be filled out by hand.

My first idea would be to use a few TITLE statements for the logo and the title lines and then a few PROC REPORT statements for the remainder, adjusting the table borders according to the needs (for instance, the signature field would be a two-row, one-column table with the first row having the bottom border and the second row having the word "Signature").

I was wondering if there is either an easier (or cooler!) way to do this using the capabilities of SAS 9.4. Two ideas that came to mind were the use of ODS LAYOUT and of the ODS Report Writing Interface. Do you have any thoughts or any experiences to share on the optimal way to go about doing this?

Thank you,


PS The same question would apply in producing the accompanying randomization envelopes which will also be produced by mail-merging.

Posts: 9,364

Re: Mail merge randomization forms


  One thing you can do is #1) make your main merge document in Microsoft Word and define the merge fields over in Word. Then write your SAS program to create the values for the merge fields (usually in a CSV file). Finally, you go over to Word and start the merge using the CSV file to provide the information for each form. Another alternative #2) is to make the letter in a dataset in a SAS program and then merge your name data with the letter dataset and produce the entire letter file using ODS RTF. This previous forum posting has an example of #2

  In addition, a more automated version of #1 that uses DDE is explained in #3) this paper

  And, yet another version of #1, using ODS HTML is shown in #4) this paper


Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation