About This Book

Audience

This book is intended for users of Microsoft Office 2007 or 2010. Each chapter in this book explains how to re-create a sample that is available from http://support.sas.com/software/products/addin. Samples are available for Microsoft Excel, Microsoft Word, and Microsoft PowerPoint. By re-creating these samples, you will learn how to perform these tasks using the SAS Add-In for Microsoft Office:
  • run a SAS analysis and include the results in an Excel worksheet, Word document, or PowerPoint presentation
  • use Visual Basic code to refresh your content
  • preview the results from a SAS analysis and select the results that you want to include in the output
  • apply a custom style to your results
  • edit SAS data in Microsoft Excel
  • send content from one Microsoft Office application to another

Prerequisites for This Scenario

Software and Configuration Requirements

When you are ready to perform the tasks in this book, administrators at your site should have installed and configured all necessary components of the SAS Enterprise Intelligence Platform. You must also have the following software and permissions set up:
  • Microsoft Office 2007 or 2010 installed on your desktop.
  • permissions to access the SAS Metadata Server. SAS support personnel at your site set these permissions and provide the name and location of the SAS Metadata Server.
  • a metadata configuration file to specify which SAS Metadata Server you will connect to by default. This file enables you to access SAS data sources on remote servers. For more information about setting up a metadata configuration file, see the online Help for the SAS Add-In for Microsoft Office.

Enable the SAS Add-In in Microsoft Excel, Word, and PowerPoint

To create the examples in this document, the SAS Add-In 5.1 for Microsoft Office must be available in Excel, Word, and PowerPoint. If the SAS add-in is enabled in a specific Microsoft Office application, a SAS tab appears in the Ribbon for that Microsoft Office application. If the SAS tab is not available, contact the SAS support personnel at your site. An administrator might need to load the SAS add-in in a Microsoft Office application or use the SAS Add-In for Microsoft Office Switcher Utility to enable the SAS add-in in a Microsoft Office application.
For more information about loading the SAS add-in or the SAS Add-In for Microsoft Office Switcher Utility, see the online Help for the SAS Add-In for Microsoft Office.

Set Your Microsoft Office Documents to Support Macro-Enabled Content

The samples that you create in this book include macro-enabled content. When you save your Microsoft Office documents, you must use the file extensions for macro-enabled content. These file extensions are .xlsm in Excel, .docm in Word, and .pptm in PowerPoint. When you open a Microsoft Office document that includes macro-enabled content, you want to be notified that this content is disabled.
To receive these notifications when you open macro-enabled content in Microsoft Excel, Word, or PowerPoint:
  1. In Microsoft Office 2010, select Filethen selectOptions.
    In Microsoft Office 2007, click Microsoft Office button and select product-name Options, where product-name is Excel, Word, or PowerPoint.
    The product-name Options dialog box appears, where product-name is Excel, Word, or PowerPoint.
  2. In the selection pane, click Trust Center. The Trust Center panel appears.
  3. Click Trust Center Settings. The Trust Center dialog box appears.
  4. In the selection pane, click Macro Settings. The Macro Settings panel appears.
  5. Select Disable all macros with notification, and then click OK.
  6. Click OK to close the product-name Options dialog box.
  7. Close and restart Microsoft Excel, Word, or PowerPoint to activate this option.
Now, when you open a Microsoft Office document that contains macro-enabled content, you are warned that some active content has been disabled. To enable the content in your Microsoft Office document:
  1. In the warning message, click Options. The Microsoft Office Security Options dialog box appears.
  2. Select Enable this content, and then click OK.

Trust Access to the Object Model for a Visual Basic Project

Many dialog boxes in the SAS Add-In for Microsoft Office include a range selection tool. This tool enables you to select a range of data in Microsoft Excel. To use this tool, your Microsoft Office application must be able to access the Visual Basic Model.
To trust access to the Visual Basic Model:
  1. In Microsoft Office 2010, select Filethen selectOptions.
    In Microsoft Office 2007, click Microsoft Office button and select product-name Options, where product-name is Excel, Word, or PowerPoint.
    The product-name Options dialog box appears, where product-name is Excel, Word, or PowerPoint.
  2. In the selection pane, click Trust Center. The Trust Center panel appears.
  3. Click Trust Center Settings. The Trust Center dialog box appears.
  4. In the selection pane, click Macro Settings. The Macro Settings panel appears.
  5. Select the Trust access to the VBA project object model check box, and then click OK.
  6. Click OK to close the product-name Options dialog box.
  7. Close and restart Microsoft Excel, Word, or PowerPoint to activate this option.

Configure Your Server Connection

You must configure the connection between the SAS Add-In for Microsoft Office and a SAS Metadata Server in order to copy the data for the Word and PowerPoint examples in this book. This connection is called a profile.
To configure your server connection:
  1. In the Ribbon, click the SAS tab. In the Tools group, click Tools, and then select Connections.
    The Connections window appears.
  2. In the selection pane, click Profiles to open the Profiles panel. From this panel, select a profile and click Set Active.
    If no profiles are available, see the online Help for the SAS Add-In for Microsoft Office to learn how to create a profile.
    Note: If you do not use a profile, then you can access only the SAS server that is installed on your local machine. You cannot define libraries or share SAS resources with other SAS applications.
  3. In the selection pane, click Servers to open the Servers panel. From the drop-down list, select the default server for the active profile.
    Tip
    To complete the Word and PowerPoint tasks, you will copy data from an Excel workbook to your default server. To access these data sources, you need to know the default server for your active profile. This book assumes that your default server is SASApp.
  4. Click Close to close the Connections window.

Access to Samples and Input Data Sources

The samples that are used in this book are available from the Samples and Notes tab at http://support.sas.com/software/products/addin.
For the Microsoft Excel samples, the input data for the SAS content is included in the Excel workbook. Because data sources cannot be saved in Word or PowerPoint, the data for these samples is saved in the RunFirst.xslm workbook. You must copy this data to a SAS server. After a data source is copied to a SAS server, the data source becomes a SAS data set, and you can use it like any other SAS data source.
To copy the data for the Word and PowerPoint samples to your SAS server:
  1. Open Microsoft Excel and verify that the SAS tab is available in the Ribbon. The SAS add-in must be available in Microsoft Excel for you to copy the Excel data to the SAS server. If the SAS tab is not available, see Enable the SAS Add-In in Microsoft Excel, Word, and PowerPoint.
  2. Open the RunFirst.xlsm workbook.
    Note: The RunFirst.xlsm workbook contains some macro-enabled content. To copy the data from the workbook to a SAS server, you must enable the document for macro-enabled content. For more information, see Set Your Microsoft Office Documents to Support Macro-Enabled Content.
  3. In the Run First! worksheet, click Copy to Server.
  4. To verify that all of the data was copied to your SAS server, select Manage Content on the SAS tab. The Manage Content window appears and lists the seven data sets that were created on the SAS server.
    Tip
    The names of these data sets use the following format: server-name:library-name_data_set_name. For the examples in this book, the default server is SASApp and the library is SASData.
  5. Click Close to close the Manage Content window.
  6. Close the RunFirst.xlsm workbook in Microsoft Excel.