If you have not yet discovered the new Ask the Expert series on the SAS Training site, you are missing out on a treasure. Visit the site right now and review all of the available topics, from "Newbie" to Analytics to Visualization to good ol' SAS programming. Go on; I'll wait.
Welcome back! Amazing, right? You can get lost for hours learning new stuff or just reviewing what you thought you already knew. Some topics are available as live sessions that you can "attend" as they happen, but many of them are available on-demand, for free, no strings attached.
You might have noticed that I have a humble contribution in the "expert" collection: Developing Custom Tasks for SAS Enterprise Guide. During the 37-minute video, I lead you through the uses of SAS custom tasks and the basic steps for creating your own task. You'll learn what custom tasks can do and what they cannot do. You'll learn about the tools and APIs that support the creation of tasks. And you'll see the "inside" of a completed custom task project. (An aside: I owe a big "thank you" to the team that post-processed the recording of my expert talk -- I know that I wasn't that smooth and concise when I recorded it!)
It's a short introduction and watching it won't make you an expert in the topic, but it will help you to decide whether to learn more. You can learn more from my book on this topic, or you can arrange to attend an offering of the two-day course that we offer occasionally. Or you can learn it all on your own, as many have. There are plenty of examples and references to work from. If you're wondering what skills you should have before taking the class, watch my "about this course" video here.
In the "ask the expert" video, I referenced a collection of API libraries that make it easier to set up your custom task projects. These API libraries are available for each version of SAS Enterprise Guide, and they allow you to create tasks that are compatible with multiple versions of the SAS applications, even if you do not have those particular versions installed. (You still need at least one version of SAS Enterprise Guide or SAS Add-In for Microsoft Office in order to test and run your custom task.)
With the permission of the SAS R&D developers, I have made those libraries available here:
>> Download custom task API libraries (ZIP file 333KB)
The README.txt file in the ZIP file explains how to use the libraries.
If you have questions as you start your custom task adventures or if you just want to brag about your successes, post back here or on the SAS Enterprise Guide community. I'd love to hear from you!
15 Comments
Handy to have the collection of Ask The Expert series available by areas of interest! Thanks for sharing Chris
Chris,
When i am using the recently refreshed EGPSeracher71_x64 Task for searching SAS EG 7.11 projects i get an Error as below. I am assuming SAS 7.1 and SAS EG 7.11 Projects are the same and supported by this Custom task.Please look inot this if Possible.Thanks.
BTW i am using SAS EG 7.11 (64bit) on WIndows 7 64bit and using the EGPSeracher71_x64 search tool.
Error Details:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.MissingMethodException: Method not found: 'System.Collections.Generic.IList`1 SAS.EG.ProjectElements.ProjectCollection.GetAllElementsInContainer(System.String)'.
at EGPSearch.MainSearchWindow.SearchProject(String filename, String searchString)
at EGPSearch.MainSearchWindow.btnGo_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18444 built by: FX451RTMGDR
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
EGPSearcher71_x64
Assembly Version: 7.100.0.0
Win32 Version: 7.100.0.15158
CodeBase: file:///C:/Users/a0czw9/Downloads/EGPSearcherTool/x64/EGPSearcher71_x64.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34251 built by: FX452RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
Prashant, I'll look into it.
Hi Chris,
I am working on SAS intelligent platform 9.3...I am unable to see libraries that I have access and can able to see in Production environment but not in development enviroment, Can u please let me know what was the problem//By The way we use SAS EG 5.1 version
Siva,
This sounds like a difference in permissions between your Dev and Prod environments. You'll probably have to take this up with your SAS administrator. You could use LIBNAME LIST _ALL_ to illustrate the difference between the two environments.
Hi Chris,
Did you get a chance to look into the Error i posted above while using the EGPSeracher71_x64 Task for searching SAS EG 7.11 projects?
Thanks,
Prashant
Sorry Prashant, not yet. I'll be on holiday for a bit, so it won't be until early August that I can get to this. In the meantime, the built-in search in EG 7.1 might be helpful, though I know it is limited to just one project at a time.
Hi Chris
I was trying to create the basicstats vb Customs Task example using Visual Studio 2013 express edition and Enterprise guide 5.1 . The program got compiled successfully and the dll file was created. I copied the file to Enterprise Guide customs folder but it does not show up. I later tried to Add it through the Addin Manager and it removed all the other custom tasks. Is 2013 dll not supported with the EG 5.1.
Thanks
Shomit
Hi Shomit,
Make sure that your Visual Studio project settings are targeting the proper version of the Microsoft .NET Framework. For EG 5.1, you must target .NET 4.0 Framework (not 4.5 or 4.5.1, which might be the default setting for new Visual Studio projects).
If you need help, you can send me the DLL you built in a ZIP file (chris.hemedinger@sas.com) and I can confirm what you've built.
I had forgot to add the constructor for the class it worked fine after I added it. Thanks for the help.
Excellent! Congratulations on creating your first task.
Hi Chris.
i am approaching to build my new custom task for enterprise guide 7.1 after i bought your book.
Which .net framework version i have to address ? 4.5 ? And which visual c# express version ? 2013 is ok ?
Where can i download the tempplates for visual c# ?
thanks a lot.
You can find everything you need at this Custom Tasks page. Visual Studio express edition is okay to use -- see these notes about it. And if targeting EG 7.1 specifically the .NET version is 4.51, but you can reference earlier versions of the custom task APIs (linked to from this article) and get away with earlier versions of .NET. I usually recommend that for the most flexibility.
Hi Chris
I want to import many txt files using the SAS proc import statement in SAS EG v 5.1. I used the import task to produce SAS code which I want to use within a macro to read many files.
SAS EG copies the file from the original location specified in the import statement to a SAS work location and "cleans" the file from unknown characters. I want to reproduce this step, but is unable to do so. Any idea how Guide copies the files and cleans it?
SAS EG uses its own logic/APIs to do this cleansing, but you can remove that step from the Import Data task by selecting these options. Under Performance (button on first page), select "Bypass cleansing". And on the final page of the wizard (Advanced), select "Generalize import step to run outside of SAS Enterprise Guide."
With those two options set, the task should create code that you can run directly in SAS (as long as the input text file is available on the system). You can then generalize that step to run within a macro program.