SAS custom tasks: using Microsoft Visual Studio 2013 and other new toys

8

Writing a book about SAS (or any computer software) is both gratifying and frustrating. It's gratifying because there are so many SAS users in the world, and it feels good when you can share your expertise with them. It's also gratifying to have a volume that you can point to and say "I wrote that!"

But it's frustrating too, because computer software changes rapidly, and your book can quickly become out-of-date. Some people might call that "job security". Unfortunately, constantly revising and republishing my books isn't part of my "day job", and while rewarding in many ways, it doesn't pay the bills.

When we published Custom Tasks for SAS Enterprise Guide using Microsoft .NET, the current versions of software were:

  • SAS Enterprise Guide 5.1
  • SAS 9.3
  • Microsoft Visual Studio 2012 (very recently released at the time!)

In just 11 months since then, we are now working with SAS 9.4, SAS Enterprise Guide 6.1, and Microsoft Visual Studio 2013. I don't address these versions in my book. So readers wonder: can you use the book with the later editions of software?

The answer is Yes. The material in the book still applies, one-hundred-percent. You need to adjust the book instructions only in the most obvious ways. That is, where there is an instruction that includes a specific version number (a folder name, for example), you need only to substitute the more recent version number.

The Microsoft Visual Studio templates, which I provide as a simple way to bootstrap your custom task project, still work as they always have. I originally designed them to work with Microsoft Visual Studio 2008 and SAS Enterprise Guide 4.2. Since most users are well beyond those versions now, I've created an updated set of templates that work better with Microsoft Visual Studio 2010 and later, and SAS Enterprise Guide 4.3 and later. You can find the updated Visual Studio templates on the SAS support page for custom tasks. The download package includes templates for C# and Visual Basic, plus illustrated instructions for installation and use. The templates work with the 2010, 2012, and 2013 editions of Microsoft Visual Studio, including the free Express editions.

Custom task project in VS2013

Note: while you can use the free Express editions of Microsoft's development tools, I always recommend the professional editions for serious long-term work. The professional editions include better support for debugging task code, a feature that I find to be essential for production work.

Share

About Author

Chris Hemedinger

Director, SAS User Engagement

+Chris Hemedinger is the Director of SAS User Engagement, which includes our SAS Communities and SAS User Groups. Since 1993, Chris has worked for SAS as an author, a software developer, an R&D manager and a consultant. Inexplicably, Chris is still coasting on the limited fame he earned as an author of SAS For Dummies

8 Comments

  1. What is the benefit to 'oldtimers' (SAS Version 6 certified) to learn the new 'stuff', like Enterprise Guide and Visual Studio? I'm just now getting acquainted with 9.3 and updating my V6 and V8 code to 9.3. Now I have to learn 9.4? It's good that there are 'new' things to learn, but please also highlight the benefits of learning Enterprise Guide and Visual Studio when you promote their use. This is like the COBOL to C to .NET changes that we all had to make. Next comes SAS for PigLatin, Hadoop and Cloudera. What's a person to do? :)

    • Chris Hemedinger
      Chris Hemedinger on

      Jim,

      Where to begin? The benefit of learning new software and new features of existing software -- that depends largely on your job role and career path. The SAS System (programming language and supporting tools) has expanded so much since V6. All of your V6 techniques still work, probably, but there are better methods/procs/functions for so much of what you did back then. Databases change, operating systems change, new statistical methods come to life, and user expectations change. SAS has changed to keep up and in many cases, to lead the innovation. SAS Enterprise Guide is not really new (see its history here), but long-time SAS users are introduced to it every day. SAS offers resources like blogs and SAS Talks (see this one on SAS Enterprise Guide) so you can decide where to invest your learning cycles.

      If you want to learn more about custom tasks specifically (topic of this blog), review this SAS Talks session.

  2. Pingback: SAS author’s tip: Getting the project templates for Microsoft Visual Studio - The SAS Bookshelf

  3. Hi Chris,

    I am a newbie to sas. I am assigned a task to automate some manual SAS processes. At first my plan is to write a java application to do the job because java is my strength. An Java application always running. Every hour the app is going to find if there are some new files copied from a remote server. If new files found, some .sas scripts will be called based on the file path and name to parse the file and analyze the file, and create a report.

    I need to pass the file path and name as a parameter dynamically to the dynamically selected .sas scripts during the above process. At first I think it is simple because I just call the scripts by using command

    "sas -sysparm 'A B C' sas_script.sas"

    But after I talked with our SAS server administrator, I am told that I cannot use the above command anymore because we are currently using Client-Server version of SAS. The above command is not available anymore. We are using EG 4.3 as SAS client.

    After search the web, I found only your blog and answers shine some light on my task. I definitely need to call the sas_scripts.sas with parameter passing.

    Can you give me some help (.net or VBA is OK, what I really need is passing the parameter to the sas scripts)? you help is really appreciated! I have read your answer on the following post:

    https://communities.sas.com/thread/4986

    Thank you very much!

    Davy

  4. Pingback: Using Microsoft Visual Studio 2013 Express to debug custom tasks - The SAS Dummy

  5. Hey Chris,

    I just got access to EG 6.1! My first thought was to ask about the ability, if any, to access the new Log view summary tool via custom task. We use an in-house tool to analyze logs currently, but I'd love to use any exposed dlls or the like via custom task if at all possible. Partially this is driven by a desire to flag different/additional items in the log to review than other than the default (is there a way to add things to the list? We've got a list of things we flag using regex in our homebrew solution). If not, are there any plans to change this in the future?

    Possibly unrelated, is there a way to assign running a custom-task to a shortcut? We've got a few nifty custom tasks that we run a ton and being able to do so via shortcut would be great. If we could override the in-house ones that'd be cool but not necessary. I've explored the enhanced editor keys window you talk about here but it is not quite what I'm looking for: http://blogs.sas.com/content/sasdummy/2013/10/29/five-keyboard-shortcuts/

    Thank you,
    Scott

    • Chris Hemedinger
      Chris Hemedinger on

      Scott,

      The Log Summary window isn't part of the custom task APIs that are documented for customer use, so that's not available for your own custom applications, I'm afraid. However, you can review the contents of my paper on custom apps with SAS Integration Technologies to see how you can deal with log content in a more reliable way.

      There isn't a built-in method for assigning a custom shortcut key to a task or any other menu item/operation in SAS Enterprise Guide. I have suggested AutoHotkey in the past, and I've heard from several users that it's very useful for automating the keystrokes you want to "replay".

Back to Top