Build your own SAS client app with Microsoft .NET

This post was kindly contributed by The SAS Dummy - go there to comment and to read the full post.

As part of my follow-up to SAS Global Forum 2013, I’ve posted a few articles about how to create your own client apps with SAS Integration Technologies. This article shows how to use Microsoft .NET — the same approach used for SAS Enterprise Guide and SAS Add-In for Microsoft Office — to assemble a powerful client application.

About Microsoft .NET

Microsoft .NET, when accessed through Microsoft Visual Studio, offers a full application development platform. You can download Express editions of Microsoft Visual C# or Visual Basic .NET for free from the Microsoft website. However, if you want the best productivity with the tool, consider investing in one of the professional editions. If you’re just getting started with Microsoft .NET, check out the many resources that Microsoft offers.

How to reference SAS Integration Technologies from Microsoft .NET

To create a Microsoft .NET project that can connect to a SAS environment with SAS Integration Technologies, follow these steps in Microsoft Visual Studio:

  1. Create a new project of any type, appropriate for your objective (for example, a Windows Forms application, Console application, or Windows Presentation Foundation application).
  2. In your Visual Studio project, add references to the following DLL files:
    • SASOManInterop.dll (for SAS Object Manager classes)
    • SASInterop.dll (for SAS Workspace classes)
    • SASOMIInterop.dll (for SAS Metadata Server classes)
    • SASIOMCommonInterop.dll (supports SASInterop.dll and SASOMIInterop.dll; not used directly in these examples)

    You can find these files in the installation folder for the SAS Integration Technologies client. For example: C:\\Program Files\\SAS\\Shared Files\\Integration Technologies or C:\\Program Files\\SASHome\\x86\\Integration Technologies.

Here’s a screenshot of a Visual Studio project that contains these references:

About the sample application

As a companion to my SAS Global Forum paper, I have prepared a full sample application with these features:

  • connects to a SAS Workspace session using a server that you define in a dialog box.
  • allows you to connect to a local instance of SAS – no configuration required.
  • features three windows: a Program Editor, a log viewer, and a listing viewer. (Does that seem familiar?)
  • allows you to run a SAS program on a background thread, keeping the main user interface responsive.
  • retrieves the SAS log and listing output, and colors each line of output as appropriate (errors, warnings, notes, page boundaries).
  • Provides a simple data table viewer that supports filters.

Here is a screen capture of the application, named SAS Program Harness. It shows a program, the SAS log, and the listing output:

The sample application was built using Microsoft Visual Studio 2012. You can also use Microsoft Visual C# Express (which is free) to view, modify, and build the project. See the GitHub repository to download the project files: source code and ready-to-run binaries.

In future articles I’ll focus on some implementation details such as connecting to servers, submitting programs, and viewing data. However, you don’t have to wait! You can review the details within the paper right now, and examine the source code on GitHub.

tags: .net, SAS Integration Technologies, sasgf13

This post was kindly contributed by The SAS Dummy - go there to comment and to read the full post.