Sas Add in Microsoft Office
Sas Add in Microsoft Office
Sas Add in Microsoft Office
2
for Microsoft Office
Getting Started with Data Analysis
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2009.
SAS Add-In 4.2 for Microsoft Office: Getting Started with Data Analysis. Cary, NC: SAS
Institute Inc.
SAS Add-In 4.2 for Microsoft Office: Getting Started with Data Analysis
Copyright 2009, SAS Institute Inc., Cary, NC, USA
ISBN 978-1-59994-843-0
All rights reserved. Produced in the United States of America.
For a hard-copy book: No part of this publication may be reproduced, stored in a
retrieval system, or transmitted, in any form or by any means, electronic, mechanical,
photocopying, or otherwise, without the prior written permission of the publisher, SAS
Institute Inc.
For a Web download or e-book: Your use of this publication shall be governed by the
terms established by the vendor at the time you acquire this publication.
U.S. Government Restricted Rights Notice. Use, duplication, or disclosure of this
software and related documentation by the U.S. government is subject to the Agreement
with SAS Institute and the restrictions set forth in FAR 52.227-19 Commercial Computer
Software-Restricted Rights (June 1987).
SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513.
1st electronic book, February 2009
1st printing, March 2009
SAS Publishing provides a complete selection of books and electronic products to help
customers use SAS software to its fullest potential. For more information about our
e-books, e-learning products, CDs, and hard-copy books, visit the SAS Publishing Web site
at support.sas.com/publishing or call 1-800-727-3228.
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 registered trademarks or trademarks of their
respective companies.
Contents
Glossary 51
Index 53
iv
1
CHAPTER
1
Introduction to the SAS Add-In
for Microsoft Ofce
You can perform a variety of tasks using the SAS add-in. The following process
briefly explains how you would run a SAS analysis:
1 Open Microsoft Excel.
2 Select the analysis that you want to perform.
Note: After you select the analysis, you might be prompted to log in to the SAS
server if you have not previously logged in during the current session. You must
be connected to a SAS server to run an analysis or to access a SAS data source. 4
3 Select the data source that you want to use in the analysis. In Excel, you can use
data in an existing Excel worksheet or in a SAS data source. If you select a SAS
data source, you can choose to filter and sort the data before the analysis.
Note: If the SAS data source is open in an Excel worksheet, then the task uses
the filter and sort criteria that you specified when opening the data source. 4
4 Select the options in the analysis that you want to use and then run the analysis.
5 Specify the location of the output. For example, in Excel you can choose to include
the results in the existing worksheet, in a new worksheet, or in a new workbook.
The results automatically open in Excel in the location that you chose.
Note: The SAS add-in is also available in Microsoft Word and PowerPoint. 4
CHAPTER
2
Learning by Example: Analyzing
and Reporting Using SAS
How to Get Help for the SAS Add-In for Microsoft Ofce
Use any of the following methods to get Help for the SAS Add-In for Microsoft Office:
3 In the Ribbon, click the SAS tab. In the Manage group, click Help and select SAS
Add-In for Microsoft Office Help.
3 Press F1 in most application windows and dialog boxes.
7
CHAPTER
3
Opening a SAS Data Source in
Microsoft Excel
Note: In this scenario, you are accessing a SAS data source from the SAS server.
However, you can use the SAS add-in to access data from a database, such as
Oracle, Teradata, and DB2. In Excel, you can also use Excel worksheets as the
data source. 4
2 For the data source, select the following:
3 the variables to include in the output
3 the sorting order for the data
3 the output location for the data
2 In the Ribbon, select the SAS tab. In the Data Options group, click Open Data
and select Into Worksheet. The Open Data Source window opens.
3 Click to select the SAS server that you want to use. The Open Data Source
window now displays the libraries on the selected server.
4 Select SASHELP and click Open. The Open Data Source window now displays the
contents of the SASHELP library.
Note: The location of the SASHELP library is dependent on how SAS was
installed at your site. If you cannot find the SASHELP library, contact the SAS
support personnel at your site. 4
5 In the SASHELP library, select the SHOES data source and click Open. The Modify
Data Source window opens.
6 On the Variables tab, select the variables that you want to include in the final
output. You can also specify the order of the variables.
Opening a SAS Data Source in Microsoft Excel 4 Open the Sales Data in an Excel Worksheet 9
Click to move all the variables from the Available list box to the
Selected list box. Select the variables so they appear in the following order:
Click OK. The results open in a new worksheet called Worldwide Shoe Sales.
10 Save the Workbook 4 Chapter 3
1 Click and select Save As I Excel Workbook. The Save As dialog box
opens.
2 From the Save in drop-down list, select C:\My Documents.
3 Type Shoe Sales 2008 in the File name box.
4 Click Save to save the workbook.
You are now ready to analyze the data source. For the next steps, see Chapter 4,
Running SAS Tasks to Analyze the Data, on page 11.
Tip: After opening a data source in Excel, you do not have to save the workbook
before analyzing the data.
11
CHAPTER
4
Running SAS Tasks to Analyze
the Data
Tip: In Excel, data sources that are open are at the top of the Active Data
drop-down list and have an exclamation point (!) before the name. By default, the
current selection is the active data source. Depending on where your cursor is in a
worksheet, you might have a different active data source.
2 In the Analyze Data & Report group, click Graphs and select Bar Chart
Wizard. The Bar Chart Wizard opens.
3 In step 1 of the wizard, you can verify that you have selected the data source that
you want to use.
Tip: You cannot change the data source after you open a SAS task. However,
you can apply a filter by clicking Edit.
For this example, you should have the SHOES data source as the active data.
Click Next to continue.
4 In step 2 of the wizard, you can assign variables from the data to roles. You can
also specify whether to create a horizontal bar chart. By default, the Bar Chart
Wizard creates vertical bar charts.
In the second step, specify the following options:
3 From the Bars drop-down list, select Product.
3 From the Bar height drop-down list, select Total Sales.
Running SAS Tasks to Analyze the Data 4 Compare Sales for Each Product 13
Click OK. The results open in a new worksheet called Total Sales for Each
Product.
16 Determine Average Sales, Inventory, and Returns for Each Product 4 Chapter 4
2 In the Analyze Data & Report group, click Describe and select Summary
Statistics Wizard. The Summary Statistics Wizard opens.
3 In step 1 of the wizard, you can verify that you have selected the data source that
you want to use.
Tip: You cannot change the data source after you have opened a SAS task.
However, you can apply a filter by clicking Edit.
For this example, you should have the SHOES data source as the active data.
Click Next to continue.
Running SAS Tasks to Analyze the Data 4 Determine Average Sales, Inventory, and Returns for Each Product 17
4 In step 2 of the wizard, you can assign variables from the data to roles.
Select the following variables in the Available variables pane and drag and
drop them to the following roles:
Variables Role
The statistics that are listed in the Summary Statistics Wizard should now be
as shown:
The output shows the mean, standard deviation, minimum value, maximum value
and range of the total sales, total inventory, and total returns for each product. An
analysis shows the following aspects of the data:
3 For each product, the average total cost of the inventory exceeds the average total
sales. For example, for Boots, the average total inventory is $187,012.90, but the
average total sales is only $45,202.75.
3 The ranges for all products are rather large. For example, for Boots, the minimum
total sales is $1,179 and the maximum total sales is $286,497. This large range
($285,318.00) implies that sales for boots vary across stores worldwide.
2 In the Analyze Data & Report group, click Analyze Data. The Analyze Data
window opens.
22 Determine Correlation between Sales, Inventory, and Returns 4 Chapter 4
3 In the left pane, select Multivariate. The list of tasks in this category appears in
the right pane.
Variables Role
The output shows the correlation statistics for the correlation between sales and
inventory and sales and returns. An analysis shows the following aspects of the data:
3 The correlation between sales and inventory is 0.95444. This implies a strong
positive correlation between sales and inventory.
3 The correlation between sales and returns is 0.96434. This implies a strong
positive correlation between sales and returns.
3 The scatter plots also reflect this strong positive correlation. The scatter plots also
show that the data contains a few possible outliers.
2 In the Analyze Data & Report group, click Analyze Data. The Analyze Data
window opens.
3 In the left pane, select Regression. The list of tasks in this category appears in
the right pane.
Running SAS Tasks to Analyze the Data 4 Perform a Linear Regression Analysis 27
4 Select Linear Regression and click Open. The Linear Regression task opens.
5 In the Data panel, you can assign variables from the data source to task roles.
Select the following variables in the Variables to assign pane and drag and
drop them to the following roles:
Variables Role
Before running this analysis, you assumed a significance level of 0.05. Therefore, any
parameter estimates that have a p-value less than 0.05 should be included in the
model. Any parameter estimates that have a p-value greater than 0.05 should not be
included in the model.
The following analysis of the Boot product shows you how to analyze the results for
each product.
3 You can use the Pr>|t| column in the Parameter Estimates table to determine
whether an input is statistically significant and should be included in the model.
The total inventory and total returns have a p-value less than 0.05, so these
inputs can be included in the model.
30 Perform a Linear Regression Analysis 4 Chapter 4
3 After you have determined that an input is statistically significant, you can use
the value in the Parameter Estimate column to determine the impact that these
inputs have.
The impact that each of these inputs have on total sales is as follows:
3 For each $1.00 spent on inventory, total sales increase by $0.10.
3 For each $1.00 of returns, total sales increase by $17.07. While at first this result
was confusing, you remembered that some of your stores charge a 20% re-stocking
fee on all returns. This means that your company still makes some money off of
returned items.
Running SAS Tasks to Analyze the Data 4 Save the Workbook 31
CHAPTER
5
Analyzing a SAS Data Source in
a PivotTable Report
Note: In this scenario, you are accessing a SAS data source from the SAS server.
However, you can use the SAS add-in to access data from a database, such as
Oracle, Teradata, and DB2. In Excel, you can also use Excel worksheets as the
data source. 4
2 For the data source, select the following:
3 the variables to include in the output
3 a filter to subset the data
3 the output location for the PivotTable report
2 Click to select the SAS server that you want to use. The Open Data Source
window now displays the libraries on the selected server.
3 Select SASHELP and click Open. The Open Data Source window now displays the
contents of the SASHELP library.
34 Open the Sales Data into a PivotTable Report 4 Chapter 5
Note: The location of the SASHELP library is dependent on how SAS was
installed at your site. If you cannot find the SASHELP library, contact the SAS
support personnel at your site. 4
4 In the SASHELP library, select the SHOES data source, and click Open. The Modify
Data Source window opens.
5 On the Variables tab, you select the variables that you want to include in the
final output. You can also specify the order of the variables.
Click to move all the variables from the Available list box to the
Selected list box. Select the variables so they appear in the following order:
Use the drop-down lists and the text box to create the following filter:
Click OK. The PivotTable report opens in a new worksheet called Sport Shoe
Sales Less Than 10,000.
36 Create a PivotTable Report for the Sport Shoe Product Line 4 Chapter 5
2 From the PivotTable Field List, drag and drop Product to the area marked Drop
Column Fields Here.
3 From the PivotTable Field List, drag and drop Total Sales in the area marked
Drop Data Items Here.
38 Drilling Down on the Data for Asia in the PivotTable Report 4 Chapter 5
The results show that three regions (Asia, Middle East, and Central America/
Caribbean) have total sport shoe sales under $10,000. Asia has the lowest sales, so you
want to drill-down on the data in the Asia region to investigate further.
The Asia row now shows the sales for the Seoul and Tokyo subsidiaries.
Analyzing a SAS Data Source in a PivotTable Report 4 Drilling Down on the Data for Asia in the PivotTable Report 39
3 In the Subsidiary column, right-click on the Seoul cell. From the pop-up menu,
select Expand/Collapse I Expand. The Show Detail dialog box opens.
4 Select Total Inventory and click OK.
The Seoul row now shows the inventory cost for the Seoul subsidiary.
5 Right-click on the Tokyo cell. From the pop-up menu, select Expand/Collapse I
Expand.
The Tokyo row now shows the inventory cost for the Tokyo subsidiary.
40 Save the Workbook 4 Chapter 5
CHAPTER
6
Next Steps: A Quick Look at
Additional Features
2 Select the location where you want to publish your document and click Save. The
Properties dialog box for the published document opens.
3 On the Security tab, specify the security settings for the published document.
For more information about how to set the security settings for a document or
folder, click Help in this window.
Next Steps: A Quick Look at Additional Features 4 Open the Published Workbook 43
2 In the location where this report is saved, select Shoe Sales 2008.xlsx.
3 Click Open.
The document opens in Microsoft Excel.
44 Working with Favorites 4 Chapter 6
What Is a Favorite?
Favorites in the SAS add-in enable you to quickly access your most commonly used
reports and analyses. You can add published documents, reports, SAS tasks, and stored
processes to your list of favorites.
Tip: You can change the order of the results by clicking or . The
order of the results in this dialog box is the order that the results will appear in
Word or PowerPoint.
3 Click Send.
The current results automatically open in PowerPoint. You can now use the
functionality in PowerPoint to customize these slides and create your presentation.
Next Steps: A Quick Look at Additional Features 4 Refresh Your Results in Word or PowerPoint 47
2 Click Refresh.
CHAPTER
7
Recommended Reading
Recommended Reading 49
Recommended Reading
Here is the recommended reading list for this title:
3 the online Help for the SAS Add-In 4.2 for Microsoft Office
3 SAS offers instructor-led training and self-paced e-learning courses to help you get
started with the SAS add-in, learn how the SAS add-in works with the other
products in the SAS Enterprise Intelligence Platform, and learn how to run stored
processes in the SAS add-in. For more information about the courses available, see
support.sas.com/training.
For a complete list of SAS publications, go to support.sas.com/bookstore. If you
have questions about which titles you need, please contact a SAS Publishing Sales
Representative at:
Customers outside the United States and Canada, please contact your local SAS office
for assistance.
50
51
Glossary
Index
A M
accessiblity features 3 metadata configuration file 6
active data sources 11 Microsoft Office 2000-2003 1
Modify Data Source window 8, 34
analyzing data 3, 5
Filter tab 34
Output Location tab 9, 35
B Sort tab 9
Variables tab 8, 34
bar charts 11
O
C
Open Data Source window 33
Choose Location dialog box 15, 20, 25, 28
correlation 21
P
PivotTable reports 33
D
columns 37
data sources creating 36
accessing 1, 6 data items 37
drilling down to detail 38
copying 2
rows 36
filtering 34 prerequisites 6
opening in an Excel worksheet 7 published documents 2, 41
opening into PivotTable report 33 benefits 41
impact analysis 41
record limits 2
opening 43
selecting variables for output 8 publishing 41
sorting output 9
specifying output location 9 Q
Quick Access Toolbar 31, 40
F
favorites 43 R
adding 43
Refresh Multiple Window 47
running 44 refreshing results 2, 47
in Microsoft PowerPoint 47
H
Help 6 S
SAS Add-In for Microsoft Office 1
benefits 1
I
online Help 6
impact analysis 41 SAS Enterprise Guide 2
SAS Enterprise Intelligence Platform 6
SAS menu 1
L SAS Metadata Server 6
linear regression 26 SAS Stored Processes 2
54 Index