Creating Zillions of Labels (and Other Documents) the Easy Way with ODS and Microsoft Word

Similar documents
HOW TO PERFORM A MAIL MERGE (Microsoft Office 2003)

Microsoft Office 2016 Mail Merge

MAIL MERGE DIRECTORY USE THE MAIL MERGE WIZARD

Mail Merge Labels Envelopes

MAIL MERGE LABELS USE THE MAIL MERGE WIZARD

Introduction to Mail Merge. Use IT+

Mail Merge. To Use Mail Merge: Selecting Step by Step Mail Merge Wizard. Step 1:

Using Mail Merge in Microsoft Word XP/2002

Obvious reason for using a mail merge then is to save time in drafting a form document which needs to be sent to multiple folks.

BrainyBetty.Com presents: Mail merge I: Use mail merge for mass mailings

Cooperative Extension Service 4HPlus! Computer Tip

Microsoft Word 2010: Using Mail Merge

Using Mail Merge in Microsoft Word 2003

MAILMERGE WORD MESSAGES

Managing Document Properties

Merge Data from Shelby v.5 & ShelbyNext to Microsoft Word

Introduction. Mail Merge. Word 2010 Using Mail Merge. Video: Using Mail Merge in Word To Use Mail Merge: Page 1

MAIL MERGE USING MS WORD 97

Arena Word Merge Templates

A Guided Tour Through the SAS Windowing Environment Casey Cantrell, Clarion Consulting, Los Angeles, CA

Section 1 Creating Mail Merge Files

Interfacing with MS Office Conference 2017

ABSTRACT MORE THAN SYNTAX ORGANIZE YOUR WORK THE SAS ENTERPRISE GUIDE PROJECT. Paper 50-30

Word 2007 Mail Merge

Welcome to Cole On-line Help system!

SAS ENTERPRISE GUIDE USER INTERFACE

You can clear the sample data from the table by selecting the table and pressing Delete.

SAS/ASSIST Software Setup

Microsoft Word 2010 Introduction to Mail Merge

Tips and Tricks for Creating Multi-Sheet Microsoft Excel Workbooks the Easy Way with SAS. Vincent DelGobbo, SAS Institute Inc.

Nonprofit Technology Collaboration. Mail Merge

How to print a mail-merged letter using Microsoft Office Word 2002 (XP), 2003

Mail Merge Mailings Tab

ST. JOHN FISHER COLLEGE

Create and print labels for a mass mailing

Word 2010 Mail Merge. by Usman on March 05, 2010

Nonprofit Technology Collaboration. Mail Merge

People are more likely to open and read a letter than a generic letter addressed to sir, madam or to whom it may concern.

3. Click the Change Case button. 4. On the menu, click the desired case option. Managing Document Properties

Using Word 2003 for Mail Merge

Working with Mailings

Your leads. Your way. Lead delivery options for BuyerZone clients and partners.

Section Eight: Mail Merge

Session 10 MS Word. Mail Merge

Chapter 4. Learning More about Merge, and Exploring the World Wide Web

MAIL MERGE MARKETING WITH CARDEX

Enterprise Client Software for the Windows Platform

Creating a main document and a data source by using the Mail Merge Helper. Performing and viewing a merge by using the View Merged Documents button.

Open Microsoft Word: click the Start button, click Programs> Microsoft Office> Microsoft Office Word 2007.

ABSTRACT. Paper

Word: Print Address Labels Using Mail Merge

Adobe EXAM - 9A Adobe Acrobat X Pro ACE Exam. Buy Full Product.

Give m Their Way They ll Love it! Sarita Prasad Bedge, Family Care Inc., Portland, Oregon

Journey to the center of the earth Deep understanding of SAS language processing mechanism Di Chen, SAS Beijing R&D, Beijing, China

Using Mail Merge with Word

Grande Prairie Regional College

Lead Delivery Options. Your leads sent your way. Lead delivery options for clients and partners.

Table of Contents COURSE OVERVIEW... 5

Building Web Applications with SAS AppDev Studio TM 3.0

Certified Course Curriculum

Academic Personnel Services. Temporary Faculty Pool Applicant Processing Guide

Chapter 28 Saving and Printing Tables. Chapter Table of Contents SAVING AND PRINTING TABLES AS OUTPUT OBJECTS OUTPUT OBJECTS...

A set of labels. envelopes, but. is the same. number. Steps. Merge. 8. Preview. Results. 9. Finalize. With the Mailings menu open, click

Word 2010 Advanced. Student Manual

Creating letters using mail merge in Microsoft Word (Windows PC)

SAS Customer Intelligence 360: Onboarding Guide

Step 1: Prepare the worksheet data in Excel for the mail merge You can FT Menu Prompt # 1 R for Report.

Marketing tools for Check-Inn Setup Guide & Manual. Rev. 1/22/16

Word 2010 Getting Started with Word. Introduction. Getting to know Word The Ribbon. Video: Exploring Your Word 2010 Environment

Microsoft Access 2007 Module 2

This manual will explain how to do a mail merge in Cordell Connect, using the following Windows programs:

imail W eb & Print Client Guide

Exporting Variable Labels as Column Headers in Excel using SAS Chaitanya Chowdagam, MaxisIT Inc., Metuchen, NJ

Using SAS Enterprise Guide with the WIK

Grande Prairie Regional College

Paper William E Benjamin Jr, Owl Computer Consultancy, LLC

Creating a Directory with a Mail Merge from an Excel Document

Use mail merge to create and print letters and other documents

High Impact 3.0 and ACT! HTML Merge

Section 11 Mail Merge

VolunteerMatters Standard

Beginning Tutorials. A Beginner's Guide to Incorporating SAS Output in Microsoft Office Applications Vincent DelGobbo, SAS Institute Inc.

Ticket Mail Merge Instructions for MS Word 2007 and 2010

Using Word 2016: A Quick Guide

A Picture Is Worth A Thousand Data Points - Increase Understanding by Mapping Data. Paul Ciarlariello, Sinclair Community College, Dayton, OH

APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently.

Merging Mailing Labels in Office 2007

Mail Merge Word 2016

SAS Web Report Studio 3.1

Easing into Data Exploration, Reporting, and Analytics Using SAS Enterprise Guide

SAS Clinical Data Integration 2.4

Variable Data Printing in Fiery Controllers. Exercise 1: Fiery FreeForm 1

SOFTWARE AND HARDWARE REQUIREMENTS In order to use Design-time Controls, you must meet the following software and hardware requirements.

Remodeling Your Office A New Look for the SAS Add-In for Microsoft Office

Crystal Reports 2008 OFT - 700

PRACTICAL EXERCISE 1.1.6a

Chapter 3 Managing Results in Projects. Chapter Table of Contents

Introduction. Getting to Know Word The Ribbon. Word 2010 Getting Started with Word. Video: Exploring Your Word 2010 Environment.

Intermediate Microsoft Word: Mail Merge, Envelopes & Labels

Microsoft Excel Prepare Test Session File

Transcription:

Creating Zillions of Labels (and Other Documents) the Easy Way with ODS and Microsoft Word Vincent DelGobbo, SAS Institute Inc., Cary, NC ABSTRACT This paper provides a quick and easy way to generate address labels or other data-driven documents from your SAS data. The first step is to use the SAS Output Delivery System (ODS) to convert your data into a format that Microsoft Word can import. Then you use Word's Mail Merge Wizard to guide you through the steps to create your document. The technique is easy, requires only Base SAS version 8 or later, and will work on any platform where SAS is installed (even if SAS is installed on a mainframe). This technique can also be used with SAS version 6 by using the SAS HTML Formatting Tools instead of ODS. INTRODUCTION Although the mail merge feature of Microsoft Word is most often used to create form letters, it can also be used to make labels, reports, and other data-driven documents. Merging a data source with your Word document is a straightforward process. Possible data sources include Paradox, dbase, and Microsoft Access files. This paper explains how to create labels using a SAS table as the data source. You can then use the same concepts to create any type of data-driven document. The general steps are as follows: 1. Aggregate your SAS data. 2. Convert your SAS data to HTML using ODS. 3. Use the Mail Merge Wizard to create the labels, connect to the SAS data, and then print or save the resulting document. SAS 9 and Microsoft Word XP (also called Word 2002) were used in the preparation of this paper. Earlier releases of SAS and Microsoft Word can also be used. STEP 1: AGGREGATE YOUR SAS DATA When creating labels, it is important that your data contains one record per addressee. If your data contains more than one record per addressee, you must first aggregate your data. Table 1 shows a partial view of a sample SAS table (data set) named "ArizonaBusiness". Actual column (variable) names are shown in the first row of the table. companyname streetaddress cityname stateabbr ZIPCode Brewers Den 322 E Camelback Rd Phoenix AZ 85012 Arizona Valley Desert Distribu... 12329 NW Grand... El Mirage AZ 85335 Ponti Inc 2121 S 48th Street... Tempe AZ 85282 High Altitude Performance 258 E 10th Dr #101 Mesa AZ 85210 National Premier Sales & Dist... 5445 W. Missouri Ave Glendale AZ 85301 Prime Distributors 4363 E Illinois St #7 Tucson AZ 85714 Las Reynas Distributors 1665 E 18th St #204 Tucson AZ 85719 Table 1. Partial View of the Sample SAS Table "ArizonaBusiness" 1

STEP 2: CONVERT YOUR SAS DATA TO HTML USING ODS Next you must convert your SAS table to a format that Word can import. Probably the most convenient format is HTML, which is easily created using ODS and the PRINT procedure: title; footnote; ods listing close; ods html path='your-output-directory' body='arizonabusiness.htm' style=minimal; proc print data=arizonabusiness label noobs; label companyname = 'Company' streetaddress = 'Address1' cityname = 'City' stateabbr = 'State' ZIPCode run; quit; ods html close; = 'PostalCode'; * Use labels that Word likes; In the code above, your-output-directory specifies the directory where the HTML file will be stored. Note that the column labels used in the LABEL statement are special, built-in names that Word recognizes. Using these recognized column names will streamline the mail merge process by automatically mapping the column names in the data to field names in the Word document. Refer to the Appendix for a list of other recognized column names you can use when making address labels. If you do not use column labels that Word recognizes, you will have to perform a custom mapping in step 4 of the Mail Merge Wizard. If Word is not installed on the same machine as SAS, create the HTML file and move it to a location where Word can access it, such as a Web server or network-accessible drive. The DS2HTM macro, part of the HTML Formatting Tools, can be used with SAS Version 6 to create HTML files. Occasionally, Word fails to import an HTML file as a data source. This can happen when there is a large amount of data in the file. If you encounter this problem, try creating a CSV file instead of an HTML file, using ODS or the DS2CSV macro. STEP 3: USE THE MAIL MERGE WIZARD TO CREATE THE LABELS Start Microsoft Word and create a new blank document. In Word XP, access the Mail Merge Wizard by selecting Tools Letters and Mailings Mail Merge Wizard... (A similar menu selection is available in earlier versions of Word.) In step 1 of the wizard (Figure 1), select the "Labels" document type and then click the "Next" arrow at the bottom of the dialog box. In step 2 of the wizard you choose options that define the type and size of the labels. Select "Change Document Layout", and then click on "Label Options". For the product, select "Avery Standard". For the product number, select "5961 Address". If you decide to use a label that does not have a built-in template, consult the Microsoft Office Template Library to see if a template is available for download. Because the label templates are formatted as a standard Word table, you can easily use the table editing features of Word to customize the layout. Step 3 of the wizard asks you to provide a file that contains the names and addresses of the recipients. Click "Browse" and select the "ArizonaBusiness.htm" file, created earlier. Figure1. Step 1 of the Mail Merge Wizard 2

In step 4 of the wizard you arrange your labels. You can add to your label information such as a standard address block, custom address fields, electronic postage, or a postal barcode. Since we used recognized column labels in our HTML file, we can use the standard address block. Add the standard address block to your label by clicking "Address block...". Then click "OK" in the resulting Insert Address Block dialog box to accept the default choices. After adding the standard address block to the first label, you will see the following text in your Word document: ««AddressBlock»» This text indicates that a Word mail merge field has been inserted. Word mail merge fields map to columns in your data source. Because we used recognized column labels, the address block field automatically maps to the "Company", "Address1", "City", "State" and "PostalCode" columns in our HTML file. If you did not use recognized column labels when the HTML file was created, you can map the columns in your data to the individual address elements of the address block by clicking the "Match Fields..." button in the Insert Address Block dialog box. To include the address block field on all labels, click the "Update all labels" button in the Mail Merge Wizard. Figure 2 presents a partial view of how your Word document looks after all labels are updated. ««AddressBlock»» Figure 2. Partial view of the Microsoft Word Document Containing Mail Merge Fields Clicking the "Next" arrow in the wizard takes you to step 5, which previews your labels. The wizard merges the data from your HTML file into the Word document to create a preview of the labels, as shown in Figure 3. Brewers Den 322 E Camelback Rd Phoenix, AZ 85012 Arizona Valley Desert Distributing 12329 NW Grand Ave Ste N El Mirage, AZ 85335 Ponti Inc 2121 S 48th Street #106 Tempe, AZ 85282 High Altitude Performance 258 E 10th Dr #101 Mesa, AZ 85210 Figure 3. Partial View of the Microsoft Word Document with Merged Data The final step of the Mail Merge Wizard is to "Complete the merge". In this step you can choose to send your labels directly to a printer, or save a static copy of the labels in a new Word document. The static copy does not contain any Word fields, but rather contains the final, merged output. Therefore, opening this static document at a later date will not reflect any changes in your data source. Conversely, saving the original document (with the Word fields), 3

and subsequently reopening it, will cause Word to connect to your data source and dynamically rebuild the labels, picking up any changes in your data. USING THE MAIL MERGE WIZARD TO CREATE OTHER TYPES OF DOCUMENTS By selecting "Directory" as the document type in the first step of the Mail Merge wizard (Figure 1), you can generate any type of data-driven document. Simply create the document as you want it to appear, minus the data. Then use the Mail Merge Wizard or the Mail Merge toolbar to connect to a data source and insert Word fields. You can access the Mail Merge toolbar by selecting View Toolbars Mail Merge This toolbar provides all the functionality of the Mail Merge Wizard. CONCLUSION Microsoft Word's Mail Merge Wizard provides robust capabilities for creating labels, form letters, reports and other types of data-driven documents. Once a Word document is laid out, it is a relatively simple matter to connect the document to SAS data, regardless of the platform where SAS software is installed. ODS and the HTML Formatting Tools are convenient tools to convert your SAS tables to a format suitable for use with the Mail Merge Wizard. APPENDIX COLUMN NAMES RECOGNIZED FOR ADDRESSES BY MICROSOFT WORD When creating address labels you should use Word's recognized names as column labels in your data file to avoid having to manually map columns to fields. The following column names are recognized by Word, and will map to the field name of the same name: CourtesyTitle FirstName MiddleName LastName Suffix JobTitle Company Department Address1 Address2 Address3 City State PostalCode CountryOrRegion REFERENCES Microsoft Corporation. Microsoft Template Gallery, "Templates". Available at http://office.microsoft.com/en-us/templates/default.aspx SAS Institute Inc. User documentation, "Application Utilities: DS2CSV". Available at http://support.sas.com/rnd/web/intrnet/ds2csv/ds2csv.html SAS Institute Inc. User documentation, "HTML Formatting Tools". Available at http://support.sas.com/rnd/web/intrnet/format FURTHER READING Microsoft Corporation. Help and Support web site, "Frequently asked questions about mail merge in Word 2002". Available at http://support.microsoft.com/default.aspx?scid=kb;en-us;290408 Microsoft Corporation. Help and Support web site, "How to use the mail merge to create mailing labels in Word 2002". Available at http://support.microsoft.com/default.aspx?scid=kb;en-us;294684 4

ACKNOWLEDGMENTS The author would like to thank Chris Barrett of SAS Institute Inc. for his valuable contributions to this paper. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Vincent DelGobbo SAS Institute Inc. SAS Campus Drive Cary, NC 27513 Phone: (919) 677-8000 sasvcd@unx.sas.com If your registered in-house or local SAS users group would like to request this presentation as your annual SAS presentation (as a seminar, talk, or workshop) at an upcoming meeting, please submit an online User Group Request Form (http://support.sas.com/usergroups/namerica/lug-form.html) at least eight weeks in advance. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration. Other brand and product names are trademarks of their respective companies. 5