• Print  |
  • Feedback  |

Knowledge Base

More on this Topic

Feedback

SAS Enterprise Guide

Creating Custom Add-In Tasks for SAS Enterprise Guide

Learn from the Book

Introducing: Custom Tasks for SAS Enterprise Guide using Microsoft .NET
by Chris Hemedinger

Cover art for Custom Tasks book

This book takes you step-by-step through the process of creating custom tasks for use in SAS Enterprise Guide and SAS Add-In for Microsoft Office. You'll learn how you can hook in your custom processes and make them available to a wide range of SAS users.

Quick links for SAS Enterprise Guide 4.3 and later

Quick links for SAS Enterprise Guide 4.1 and earlier:

Reference documentation
(packaged as help files in ZIP archives)
For SAS Enterprise Guide 3.0 For SAS Enterprise Guide 4.1
Example custom tasks (binary files only)
(.NET assemblies, or DLLs, ready to use)
For SAS Enterprise Guide 3.0 For SAS Enterprise Guide 4.1
Example custom tasks with source code
(Visual Studio projects in ZIP archives)
For SAS Enterprise Guide 3.0
(7 tasks)
For SAS Enterprise Guide 4.1
Visual Basic .NET examples (5 tasks)
C# Examples Part 1 (8 tasks)
C# Examples Part 2 (9 tasks)
Visual Studio .NET 2003 template files for creating add-in tasks
(Template files in a ZIP archive with deployment script and instructions)
For SAS Enterprise Guide 3.0 For SAS Enterprise Guide 4.1

SAS Sudoku Solver task, as seen at SAS Global Forum 2007.

Download the task and source files here.

Looking for information about custom tasks with SAS Enterprise Guide 2.0?

You can find that information here.


SAS Enterprise Guide provides you with easy access to powerful SAS analytics and data. Now you can extend SAS Enterprise Guide to take advantage of its connectivity and services, and use it to create a custom solution that fits the needs of your organization or industry. One way to extend SAS Enterprise Guide is by creating a custom add-in task. A custom task allows you to add custom functionality that goes beyond what is delivered in the core product. Here are some examples where this can be useful:

Another key advantage of creating custom tasks -- you can use these same tasks within the SAS Add-In for Microsoft Office.

Compatibility with Custom Tasks Built for Previous Versions

This documentation describes how to create tasks for SAS Enterprise Guide 4.1 and the SAS Add-in for Microsoft Office 2.1. SAS Enterprise Guide has been extendable using add-ins since release 2.0. Although previous add-ins used a different technology, add-ins that you created for SAS Enterprise Guide 2.0 will work in SAS Enterprise Guide 3.0 and SAS Enterprise Guide 4.1, but not in version 4.2 or later.  This table summarizes the supported configurations for tasks from previous versions:

This custom task API implementation will work in these product versions
COM API (Visual Basic 6.0) provided with SAS Enterprise Guide 2.0 SAS Enterprise Guide 2.0, 3.0, and 4.1 (see note below)
.NET API (Visual Basic .NET or C#) provided with SAS Enterprise Guide 3.0 SAS Enterprise Guide 3.0 and 4.1
SAS Add-In for Microsoft Office 1.3
.NET API (Visual Basic .NET or C#) provided with SAS Enterprise Guide 4.1 SAS Enterprise Guide 4.1, 4.2, 4.3, and 5.1
SAS Add-In for Microsoft Office 2.1, 4.2, 4.3, and 5.1
.NET API (Visual Basic .NET or C#) provided with SAS Enterprise Guide 4.2 SAS Enterprise Guide 4.2, 4.3, and 5.1
SAS Add-In for Microsoft Office 4.2, 4.3, and 5.1
.NET API (Visual Basic .NET or C#) provided with SAS Enterprise Guide 4.3 SAS Enterprise Guide 4.3 and 5.1
SAS Add-In for Microsoft Office 4.3 and 5.1
.NET API (Visual Basic .NET or C#) provided with SAS Enterprise Guide 5.1 SAS Enterprise Guide 5.1
SAS Add-In for Microsoft Office 5.1

Notes:

Best Practice: Where possible, use the most recent version of the .NET API for the product release you intend to target. For example, if you plan to create custom tasks for SAS Enterprise Guide 4.1, use the version 4.1 APIs in your implementation. The most recent APIs offer the most features and best support going forward. While the COM API (usually implemented with Visual Basic 6.0) is still supported through release 4.1, it will not be supported in future releases of SAS Enterprise Guide.

Using SAS Controls Supplied with SAS Enterprise Guide 2.0: If you have an existing COM-based custom task that makes use of the user-interface controls that shipped with SAS Enterprise Guide 2.0, you will need to install those controls to use your task on a system that does not have SAS Enterprise Guide 2.0 installed.  The controls are supplied in this zip archive file:

Controls2.0.zip

You can extract the controls (all ActiveX controls with a .OCX file extension) and copy them to a new folder that you create on the target machine. Then you must register the controls with Windows so that they are available for use by your custom tasks. The zip archive contains a sample batch file that will register the control files using regsvr32.exe.

Examples for SAS Enterprise Guide 4.1 (compatible with later versions)

All examples supplied were created using Microsoft Visual Studio .NET 2003. Note: All examples are provided for illustration purposes only, and are not necessarily production-quality add-ins that are supported by SAS.

Example Features
Classic Hat
Simple example of an add-in that creates the cowboy hat graph.

Screenshot of user interface
Screenshot of task results

Implemented in: Visual Basic .NET and C#

  • Simple, uncluttered example of the essential parts of an add-in that generates a small SAS program
Data Set Contents
Creates a PROC CONTENTS report for the selected input data.

Screenshot of user interface
Screenshot of task results

Implemented in: C#

  • A simple user interface with controls that map to PROC CONTENTS options.
  • Uses active data from the project as input
Characterize Data (C#)
Creates a report on data or a library that you select, detailing the contents and characteristics of the data columns within the selected members.

Screenshot of user interface

Implemented in: C#

  • Presents a user interface to allow you to select server, library, and data set
  • Uses application services to enumerate list of servers and libraries
  • Uses SAS IOM OLE DB Provider to enumerate datasets within a .NET datagrid
  • Reads a segment of "pre-canned" SAS code from a .NET assembly to generate SAS program
Life Expectancy
Uses a 3rd party web service to create a life expectancy table, and adds that data to the project.

Screenshot of user interface
Screenshot of task results

Implemented in: C#

  • Gathers data records from an internet site using .NET to access a web service
  • Builds a DATA step with a CARDS statement to create the data in SAS
System Command
Allows you to supply a series of Windows system commands to run within your project.

Screenshot of user interface

Implemented in: C#

  • Presents a task that runs Windows system commands instead of creating a SAS program
  • Creates a custom log to store in the project, representing the results of the system commands.
SAS Catalog Explorer
Launches a mini-application that allows you to view the contents of SAS catalogs on any server you select. You can even view the contents of certain types of entries, and delete entries.

Screenshot of user interface

Implemented in: C#

  • Uses application services to enumerate list of servers and libraries
  • Uses the SAS IOM OLEDB Provider to read information about available catalogs and entries.
  • Uses the SAS FileService interface to read the contents of a catalog entry
  • Uses the SAS Enhanced Editor control within a simple .NET form to view the contents of a catalog entry
  • Uses the application services to submit code from within the add-in (to delete catalog entries using PROC CATALOG)
  • Illustrates a number of .NET controls, including toolbar, tree view, list view, and splitter window
SAS Products Checker
Analyzes the SAS server to determine which SAS products are licensed and installed.

Screenshot of user interface

Implemented in: Visual Basic .NET and C#

  • Uses application services to enumerate list of servers.
  • Uses application services to submit a SAS program
  • Uses the SAS IOM OLE DB Provider to interpret results from the SAS program
  • Optionally creates an ODS report of the installed products
  • Also works with the SAS Add-In for Microsoft Office
Compare Columns
Compares two columns in a data set using PROC COMPARE.

Screenshot of user interface
Screenshot of task results

Implemented in: Visual Basic .NET

  • Uses application services to retrieve column information about the input data
  • Uses the SAS Variable Selector control (just like the tasks that ship with Enterprise Guide and SAS Add-In for Microsoft Office)
  • Also works in SAS Add-In for Microsoft Office.
Compute Lag and Dif
Applies the LAG or DIF function a selected variable to calculate a new variable in the output data.

Screenshot of user interface

Implemented in: C#

  • Uses application services to enumerate list numeric columns from the input data
  • Use embedded bitmaps in the task to show a "preview" of what results might look like.
  • Also works in SAS Add-In for Microsoft Office.
Create Picture Format
Create a SAS picture format

Screenshot of user interface

Implemented in: Visual Basic .NET

  • Use the PICTURE statement in PROC FORMAT to create display formats for numeric, date, time, and date/time values.
  • Uses application services to enumerate list of servers and libraries.
  • Simulate a wizard user interface with multiple pages.
Area Bar Chart
Creates a bar chart where the width of the bar represents a sum or percentage of the total values.

Screenshot of user interface
Screenshot of task results

Implemented in: C#

  • Uses application services to enumerate list of servers, libraries, data sets and columns.
  • Generates a SAS program that uses the GAREABAR procedure.
  • Also works in SAS Add-In for Microsoft Office.
Edit Individual Observations
Provides an interface reminiscent of FSEDIT to view/change/insert a single record at a time.

Screenshot of user interface

Implemented in: C#

  • Uses the SAS IOM OLE DB Provider to read values from a SAS data set.
  • Use PROC SQL to update and insert individual records in a data set.
  • Use the .NET PropertyGrid control and ICustomTypeDescriptor to extend it.
Atlantic Hurricane Tracker
Uses web-based hurricane data to create tracking maps for Atlantic hurricanes from the past several years.

Screenshot of user interface
Screenshot of task results

Implemented in: C#

  • Uses the FILENAME URL access method to access public hurricane data from a web site.
  • Uses the .NET WebRequest class to access hurricane data to populate user interface controls.
  • Uses GMAP, GPROJECT, and GREDUCE procedures to generate interactive maps.
  • Also works in SAS Add-In for Microsoft Office.
Loan Comparison
Collects loan parameters and computes payments and interest, comparing results from different loans by using PROC LOAN and pie charts.

Screenshot of user interface
Screenshot of task results

Implemented in: C#

  • Generates PROC LOAN and PROC GCHART syntax to support loan comparisons
  • Also works in SAS Add-In for Microsoft Office.
Merge Data Sets
Merge data sets into a single data set, offering a variety of merge methods as illustrated in the samples area.

Screenshot of user interface
Screenshot of task results

Implemented in: Visual Basic .NET and C#

  • Uses application services to allow selection of multiple input data sets.
  • Uses application services examine column information (for appropriate merge key columns).
Paired-Bar Chart
Creates a bar chart that compares two columns with a single vertical access in the center.

Screenshot of task results

Implemented in: C#

  • Uses the SAS Variable Selector control (just like the tasks that ship with Enterprise Guide and SAS Add-In for Microsoft Office).
  • Uses DATA step manipulation and a fancy GCHART program to create a bar chart comparing two columns with a single midpoint.
Simple SAS Program Editor
A simple window with the SAS enhanced editor for creating/running SAS programs.

Screenshot of user interface

Implemented in: C#

  • Uses the SAS Enhanced Editor control within a simple .NET form.
  • Also works in SAS Add-In for Microsoft Office.
Import SPSS Data Files
Uses SAS capabilities to read SPSS .por files and create SAS data views from them.

Implemented in: C#

  • Uses SPSS library engine to read in SPSS .por files.
Zip Code Dot Map
Using response information and associated zip codes, creates a map of the United States and place dots over each zip code that indicate the relative amount of whatever is being measured.

Screenshot of user interface
Screenshot of task results

Implemented in: C#

  • Uses application services to retrieve column information about the input data
  • Uses the SAS Variable Selector control (just like the tasks that ship with Enterprise Guide and SAS Add-In for Microsoft Office).
  • Uses GMAP, GPROJECT, and GREMOVE procedures to generate interactive maps.