Home  >  Blog  >   SAS BI

Using the SAS Add-In for Microsoft Office - SAS BI

Rating: 4
  
 
4871
  1. Share:
SAS BI Articles

The SAS ADD-IN for Microsoft Office adds a

  • SAS menu to the menu bar
  • SAS Analysis toolbar
  • SAS Data Analysis toolbar (Excel only).

SAS Menu for Microsoft Excel

The SAS menu in Microsoft Excel provides access to the functionality of the SAS Add-In for Microsoft Office, including the following:

  • Ability to run stored processes or SAS task
  • Tools to work with a SAS data source
  • Options for the SAS Add-In
  • Ability to specify the server
  • The style manager to customize the appearance of results returned to Microsoft.
style manager to customize

SAS Menu for Microsoft Word

The SAS menu in Microsoft Word provides access to the functionality of the SAS Add-In for Microsoft Office, including the following:

  • Ability to run stored processes or SAS task
  • Options for the SAS Add-In
  • Ability to specify the server
  • The style manager to customize the appearance of results returned to Microsoft

SAS Menu for Microsoft Word

SAS Add-In Options – Excel

The SAS Add-In for Microsoft Office options for Excel is specified by selecting SAS Ð Options….

SAS Add-In Options – Excel

SAS Add-In Options– Word

The SAS Add-In for Microsoft Office options for Word are specified by selecting SAS Ð Options….

SAS Analysis Tools Toolbar

The SAS Analysis Tools toolbar provides access to some of the same options as the SAS menu.
Some of the tasks that can be performed include the following:

  • Changing the active data source
  • Showing labels in the first row
  • Refreshing the results
  • Viewing the data
  • Browsing SAS programs
  • Exporting results to MS Word
  • Accessing your SAS Favorites.
Related Article: SAS BI Interview Questions

SAS Data Analysis Toolbar

The SAS Data Analysis toolbar provides access to options for working with SAS data.
The tasks that can be performed include the following:

  • Opening a SAS data source
  • Navigating through the data
  • Using a filter
  • Sorting the

The SAS Data Analysis toolbar is not available in Microsoft Word.

MindMajix Youtube Channel

Filtering SAS Data in Microsoft Excel

The SAS Add-In for Microsoft Office can filter SAS data before bringing it into Excel.

Filtering SAS Data in Microsoft Excel

Selecting opens an Expression Editor window for creating more advanced expressions.

expression editor

Sorting SAS Data in Microsoft Excel

The SAS Add-In for Microsoft Office can also sort SAS data before bringing it into Excel.

Sorting SAS Data in Microsoft Excel

Restricting SAS Columns in Microsoft Excel

The SAS Add-In for Microsoft Office provides a mechanism to select which columns are displayed.

Restricting SAS Columns in Microsoft Excel

Built-In SAS Tasks

The SAS Add-In for Microsoft Office provides access to most of the same tasks found in the SAS Enterprise Guide.
These tasks are broken down into the following categories:

  • ANOVA
  • Basic Analysis
  • Capability
  • Control Charts
  • Data
  • Describe
  • Graph
  • Multivariate
  • Pareto
  • Regression
  • Survival Analysis
  • Time Series
Related Article: Learn New Features of SAS Enterprise Guide 3 in SAS BI

Using the SAS Add-In for Microsoft Office

For this demonstration, you will

  • Set the SAS Add-In for Microsoft Office options
  • Run stored processes
  • Access a SAS data source
  • Show filtering and sorting
  • Run a built-in SAS task.

SAS Add-In for Microsoft Office

  1. Invoke Microsoft Excel by selecting Start Ð All Programs Ð Microsoft Office Ð Microsoft Excel.
  2. Select SAS Ð Options from the pull-down menu.
  3. The SAS Add-In displays an information window while it connects to the SAS Metadata Server.

sas add in

4. If prompted, enter the user name and password provided by your instructor.

server login

Select 

ok button

5. The Options window opens with the Data tab selected.

sas add-in options window

This tab is where you can set the number of observations to display as each “page” of data is requested from the SAS Server.
6. Select the Results tab.

sas add-in results tab

This tab can be used to set how the results are returned, HTML or CSV.
Using this tab you can also select whether or not the SAS log should be displayed.
7. Select the Graph tab.

Graph tab

This tab is where you can select the image format for graph. The valid values are as follows:

  • ActiveX
  • ActiveX image
  • GIF
  • JPEG
  • PNG

8. Select the Tasks tab.

Select the Tasks tab

9. Change the default SAS server to use SASMain instead of Local (the default).

default sas server

10. Select the Stored Processes tab.

stored processed tab

11. Select to close the Options window and save the changes.

Run a Stored Process Using the SAS Add-In for Microsoft Office

12. Select SAS Ð Browse SAS Programs from the pull-down menus (or select on the toolbar).
a. Expand the Stored Processes tree (select Stored Processes Ð Samples) and select Stored Processes.
b. Select Sample: Frequency Analysis of Municipalities.

browse sas programs

Sample stored processes are automatically provided with the Web Infrastructure Kit. These samples can be run to verify that the system is configured properly and to sample the capabilities of stored processes.
c. Select 

run

add-in window

The program results are streamed back to an Excel worksheet which is given the name of the stored process.

excel worksheet

The results are displayed in a read-only worksheet, so the values cannot be updated. To edit the worksheet, select Tools Ð Protection Ð Unprotect Sheet….
If you always want the sheet unprotected, you can specify that by selecting SAS ÐOptions and then deselecting the Protect data worksheet check box on the Data tab.

Send Results from Excel to Word

13. Select SAS Ð Send to Microsoft Word (or select from the toolbar).

excel to word

When an analysis is selected to be sent to Word, the stored process runs again to incorporate any changes that were made to the data source before the analysis is seen. After the output is available in the Word document, the document can be edited and new text is added using the functionality of Microsoft Word.

14. You can also run stored processes directly from Microsoft Select SAS ÐBrowse SAS Programs.
a. If prompted, enter the username and password provided by your instructor.

metadata server login window

b. Navigate to the stored process created earlier by expanding the tree (select Stored Processes ÐTraining).
c. Select Orion Customer List.

browse sas programs

Select 

run

15. Because this stored process has a parameter, you are prompted to enter a Type 10 and select
run

orion customer list

details in word document

The output from the Stored Process is streamed back to the cursor position in the current document unless the Insert results into current document option is deselected on the Results tab of the SAS Options in Word.
16. Close Word by selecting File Ð Exit (do not save the changes).

Managing Favorites

17. Back in Excel, select SAS Ð My SAS Favorites Ð Manage Favorites….
18. Add a stored process sample to My SAS Favourites.
        a. Expand Stored Processes and Samples, select Stored Processes.
        b. Right-click Sample: Frequency Analysis of Municipalities.
        c. Select Add to Favorites.

managing favorites

19. Add another stored process to My SAS Favourites.
        a. Select Training.
        b. Right-click Orion Customer List.
        c. Select Add to Favorites.

add to favorites

20. Add a Task to My SAS Favourites.
        a. Expand SAS Tasks and Describe.
        b. Right-click One-Way Frequencies.
        c. Select Add to Favorites.

sas tasks

21. Close the Manage Favorites window by selecting 

close button

22. Select My SAS Favorites from the toolbar, and notice that the newly added favorites are on the list:

favorites window

23. Organize favorites by selecting Manage Favorites….
24. Select the New Favorites Folder icon (

sample icon
) and type Samples as the name of the new folder

create or open new window

25. Drag the Sample: Frequency Analysis of Municipalities and drop it into the new folder Samples.
26. Select to close the Manage Favorites window.

Add SAS Data to Excel

The SAS Add-In for Microsoft Office allows Excel to access SAS data from a server or your local machine and add it to an Excel workbook.
27. Select SAS Ð Open SAS Data Source from the pull-down menus (or select from the toolbar).
a. Select Servers from the Shortcut Bar, then choose SASMain.

open sas data source

Select 

open button

b. Select Orion Star Gold Library, then choose 

open sas data source 1

c. Select CUSTOMER_DIM, then choose 

open button 2

CUSTOMER_DIM

If you cannot read the entire name of a table, use the View Mode icon on the toolbar to change the view to Detail or List.
The first “page” of data is streamed back to an Excel worksheet which is given the name of the library reference and table name.

view mode icon

Working with Data in Excel Using the SAS Add-In

Excel limits the number of rows available in a worksheet to 65,536 and the columns to 256.

By adding data sources to your workbook via SAS, you can open data sources that are larger than 65,536 rows or have more than 256 columns or both. The SAS Add-In has options to set a number of rows to view and provides a mechanism to select only the columns you want to see.

The SAS Data Analysis toolbar can be used to navigate through the data, apply a filter, sort the data, and restrict which columns to display.

Working with Data in Excel

28. Click on the range of records (1-5000) from the SAS Data Analysis toolbar to change the starting point (or select SAS Ð Navigate SAS Data Source Ð Go To Record).

index window

29. Type in a value of 4000, then click on  

ok button

values in worksheet

The worksheet now displays records 4000-8999.
The default number of rows that is displayed can be changed from the Data tab of the SAS Options window in Excel.

sas add-in options

The arrow tools on the SAS Data Analysis toolbar allows scrolling through the data. The arrows with the bars next to them take you all the way to the beginning or end of the data. The single arrows scrolls one “page” of data at a time (5,000 rows by default).
30. Select

arrow1
(or SAS Ð Navigate SAS Data Source Ð Go to End).
31. Select
arrow2
(or SAS Ð Navigate SAS Data Source Ð Go to  Start).

SAS Data Can Be Subset in Excel by Using a Filter

32. Filter the data so that only United States customers who are also Orion Star Group Members are displayed.
a. Select the SAS Data Analysis toolbar (or select SAS Ð Filter SAS Data Source).
b. Select in the first box and select the desired column name, Customer Country.

more data options window

c. Select  in the second box and specify the filter criteria, Is equal to.

more data options window1

d. Select  in the third box and select the desired value, US.

selecting the country

e. Select 

ok button

f. Select  in the last box and specify a condition (AND) in order to create combination filter.

filter the output

g. Complete the new line of the filter for Customer  Group  Name Is equal to Orion  Club  Gold  members.

h. Select

validate
 to validate the filter.

sas add-in

i. Select

ok button
 to close validation window.
j. Select
advanced edit1
 to open the Advanced Expression Editor window.

advanced expression editor1

The Advanced Expression Editor is very similar to the editor in SAS ETL Studio.
k. Select

ok button
 to close the Advanced Expression Editor window and apply the specified filter to the data.
l. Select OK to close the More Data Options window and apply the specified filter to the data.
The expression is evaluated on the Workspace Server and the first “page” of filtered data is returned to Excel.

full data in excel sheet

 to  to indicate that a filter is applied.

SAS Data Can Be Sorted in Excel by Specifying a Sort Criteria

33. Sort the data by the customer’s first and last names.
a. Select

sorting icon
 on the SAS Data Analysis toolbar, or select SAS Ð Sort SAS Data Source.
b. Select
icon1
 in the box and select Customer Last Name.

Specifying a Sort Criteria

c. To sort by first name within last name, select in the second box and select Customer First  Name.

using preferences

d. Select

ok button4
 to close the More Data Options window and sort the data.
The data is sorted on the Workspace Server and the first “page” of sorted data is returned to Excel.

desired output

Built-In SAS Tasks are Helpful in Analyzing Data

34. Select SAS Ð Browse SAS Programs.
a. Expand SAS Tasks and select Describe Ð One-Way Frequencies.

browse sas programs1

b. Select

run button
.The One-Way Frequencies Experimental Wizard opens with a list of the available columns.

task roles

c. Select Customer_Age_Group and Customer_Gender as Analysis variables.

one way frequencies

d. Select Statistics in the list on the left, then select Frequencies and percentages.

Frequencies and percentages

e. Select Plots in the list on the left, then select Horizontal.

selecting the horizontal

Select 

run button 2

The frequency task runs and displays the results in the worksheet that is given the name of the SAS task.

requency task

35. Close Excel by selecting File Ð Exit (do not save the changes).

 

Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

About Author

Vinod M is a Big data expert writer at Mindmajix and contributes in-depth articles on various Big Data Technologies. He also has experience in writing for Docker, Hadoop, Microservices, Commvault, and few BI tools. You can be in touch with him via LinkedIn and Twitter.

read more
Recommended Courses

1 / 15