Viewing SAS catalogs from SAS Enterprise Guide

33

SAS catalogs have been around for a long time. Not quite as long as the Sears or L.L. Bean catalogs, but SAS customers have used catalogs to store and retrieve content for many years.

A SAS catalog is a special type of SAS file that acts as a container, like a folder, for a variety of content items called catalog entries. Conceptually, this is like a folder in a file system with a diverse collection of file types. The entries and their uses are specific to SAS, and they include things like SOURCE (program code), SCL (SAS Component Language) programs, SAS format definitions, compiled SAS macro programs, and more.

Because SAS catalog content is used most often "behind the scenes", SAS Enterprise Guide users don't typically need to see or manage catalogs. But experienced SAS users remember using the CATALOG window in SAS Display Manager to view and manage the content, and some of you miss this within SAS Enterprise Guide.

Update 04Aug2017: There is now an updated version of this task that allows you to view the content of user-defined formats and informats -- a feature that was highly requested. See the blog post about the update here, and watch a video demonstration of the task on SAS Support Communities.

We've created a custom task to bring some of these features into SAS Enterprise Guide. With the SAS Catalog Explorer task, you can view the catalogs in your SAS libraries, and view the lists of catalog entries within the catalogs. You can also see the text content of certain entries, such as SOURCE and SCL programs (if source is compiled in). And you can delete entries.

SAS Catalog Explorer

To use the task in SAS Enterprise Guide 4.2:

  1. Make sure you have Microsoft .NET 3.5 SP1 installed. Most Windows 7 and Vista machines will have it; Windows XP users might need to add it.
  2. Download the file (ZIP archive) from the support site.
  3. Follow the instructions in README.txt (in the archive) to make the task available for use.
  4. The task will appear in the Tools menu under Add-Ins->SAS Catalog Explorer.

As a special bonus, this GitHub repo contains the source code (in C#) for this task, which you can build and modify with Microsoft Visual Studio 2008 or Visual C# Express Edition. The task uses several built-in toolkit classes from SAS Enterprise Guide, plus a little bit of the FILENAME CATALOG method and PROC CATALOG.

Have feedback on the task? Please respond via comment here; we'd love to know what additional features are important to you.

Share

About Author

Chris Hemedinger

Senior Manager, SAS Online Communities

+Chris Hemedinger is the manager of SAS Online Communities. He's also co-author of the popular SAS for Dummies book, author of Custom Tasks for SAS Enterprise Guide using Microsoft .NET, and a frequent participant on the SAS Enterprise Guide discussion forum.

Related Posts

33 Comments

  1. Hello Chris

    and thank you for a good hint. I would like to suggest that you develop this Add-in a little bit more. Now it is easy to view content of the catalog but I would like to view also content of the specific item. For example when I view the content of the format catalog I get the list of formats in the catalog. Moreover I would like to view the content of the specific format as SAS-dataset (the same way as I'm able to do with Proc Format-- select -statement)

    • Chris Hemedinger
      Chris Hemedinger on

      Kristiina,
      That is a good suggestion, and it's on my to-do list. Just need to get a slice of time to complete it :)

  2. Hi Chris
    I tried using this with EG 5.1 and couldn't import it. Does this require some modification to work with EG 5.1 (and if so, are you planning to post an update)? Thanks!

    • Chris Hemedinger
      Chris Hemedinger on

      Mark, it should work with 5.1, and has in my tests. Make sure you're loading it from a local file location (and not a network drive).

  3. Pingback: 11 super-useful custom tasks for SAS Enterprise Guide - The SAS Dummy

  4. leonard wilkerson on

    Hello Chris, I would like to use this custom task to display our catalogs, but also to be able to add a file (source code) etc, how can I do this, I have not programmed in C in a while and I would hate to add to the custom task SAS Catalog exployer source code and mess up other parts of the code. Therefore is there code you code provide that would add, edit, and delete items within a catalog like you can do in PC SAS. Thanks in advance.

    Some of the comments I got from SAS are -

    This task by default does not have this capability:
    With the SAS Catalog Explorer task, you can view the catalogs in your SAS libraries, and view the lists of catalog entries within the catalogs. You can also see the text content of certain entries, such as SOURCE and SCL programs (if source is compiled in). And you can delete entries.

    If you would like extra functionality build into this you can add it yourself as we distribute the source code, also if you have any issues with the task I would recommend reaching out to Chris H via commenting on that blog with any queries.

    • Chris Hemedinger
      Chris Hemedinger on

      Leonard,

      You can find and download the source code from our support site or also from this GitHub repository. Take a look, and see if the project looks like something you can tackle. I think it can be done without jeopardizing the existing code too much. And don't worry -- you're modifying only your local version and won't affect anyone else. If you mess it up too badly, you can always start over :).

      If I understand you, you're interested in providing a way to add a new SOURCE entry into a catalog. You would achieve that by using the FILENAME CATALOG method, similar to this example.

  5. leonard wilkerson on

    Thanks Chris,

    I will try it, but we are trying to add a button to add just as you have view and delete. I have not programmed in C in a long time though. I must say your Custom Tasks have been very helpful.

    • Chris Hemedinger
      Chris Hemedinger on

      Thanks Leonard -- I'll add this idea to my "backlog" and if I get to it, I'll definitely write about here.

  6. leonard wilkerson on

    Hello Chris, is there a way to get the behind the scenes code for EG - for example in EG I can connect to a SQL Server data source and pull upto 10k of data for any table I have a ODBC data source. Is there anyway to see this code.

    • Chris Hemedinger
      Chris Hemedinger on

      Leonard,

      If you're using File->Open ODBC from the EG menu, there is no SAS code involved. EG is using ODBC APIs to read the data, then SAS APIs to write the data set. The more efficient method (and SAS program method) is to use LIBNAME ODBC or OLE DB to access the data. This requires SAS/ACCESS to ODBC (or OLE DB) and a method to connect from your SAS session. That is, if your SAS server is on a different machine you'll need the appropriate data providers and connections defined from that machine, instead of from your EG PC.

      • leonard wilkerson on

        Hello Chris, we have a window7 setup that does not allow pc files server or pc files service to work properly, we do have a data direct method that works, but doesnt help with excel to a network drive. Do you know if we have a F & P server for these files can we use data direct.

        Thanks as always for taking the time to help

        • Chris Hemedinger
          Chris Hemedinger on

          Leonard, I don't know the answer. If I understand you correctly, you are using ODBC via a Data Direct driver to create output, but your challenge is to target that output to a network drive. I don't understand the limitation you have with PC Files Server -- there is nothing inherent about Windows 7 that should prevent it from working, but perhaps your IT setup is limiting this feature. Your best course of action is to contact SAS Tech Support and explain your situation and goal in as much detail as possible. If possible, it would be good to pull your IT support into the conversation as well so that you can agree on a shared goal and follow-up action.

  7. I'd like to see the programming code of each macro stored in MACRO.SASMACR but i don´t know how to get it.

    Could you help me?

    Thanks a lot

  8. Hi Chris,

    Is SAS Catalog Explorer already loaded in EG 7.1? I could not find it, but again I am totally new o EG, thanks!

  9. Hi Chris,

    this has been working fine with EG 7.1 HF1 (7.100.0.2002) (32-bit). Running on the same machine with EG 7.12 HF3 (7.100.2.3444) (32-bit) I get this error message:
    SAS Workspace is not usable!
    Could not establish a connection to the server on the requested machine. Verify that the server has been started and that the host and port of the server match the client's connection information. [should be as it works fine with the same user / same settings in 7.1]

    Any ideas? Thank you!

    • Chris Hemedinger
      Chris Hemedinger on

      Are you using the 4.1 version of this or the 4.2 version? You should be using the 4.2 version (SAS.Tasks.Examples.CatalogExplorer.dll). Do other tasks work okay on this version of EG (I would assume so, since you didn't say...) Try Tools->SAS Macro Variable Viewer.

      • Thank you! I am using 4.2 version. The hint with the SAS Macro Variable Viewer helped me as it didn't work, too. But with the error message from this I changed the default server for the active profile (aaargh!). Now both tasks work :)

        Thanks you for taking the time to help!

  10. Lucía Rodrigo on

    Hi Chris,

    I'm a SAS EG user (7.13 HF5 (7.100.3.5486) (64-bit)) trying desesperately to recover the old SAS base functionality of being able to check format definitions.
    I have installed your SAS Catalog Explorer and now I can see format catalogs inside my libraries. However, when I select a certain catalog element and click on "View content", in the box where initially there's a message saying "Select a catalog entry to view its content", now it appears blank instead of showing the format definition or macro content as in your example.

    Is it due to an incompatibility with this new SAS Eg 7.13 version or am I doing anything wrong when installing it?

    I checked and I've installed the 4.2 version of the Catalog Explorer.

    Thanks a lot for your help!!

    • Chris Hemedinger
      Chris Hemedinger on

      Hi Lucia, Sorry to say that this task doesn't implement a "format" viewer. The only type of catalog entry it can view are text-based entries, like SOURCE. However, lots of people ask for this so I'll look at adding it.

  11. Pingback: Viewing SAS catalogs and formats in SAS Enterprise Guide - The SAS Dummy

  12. Hi Chris,

    I tried to use this in a laptop with Windows 10 and SAS EG 7.1. The message was:

    "Could not load file or assembly 'SASInterop, Version=1.4.0.0, Culture=neutral, PublicKeyToken=be58efc3b934219b' or one of its dependencies. The system cannot find the file specified."

    Would you have any idea why this error comes up? Thanks!!

    • Chris Hemedinger
      Chris Hemedinger on

      I recommend NOT using the Add-In Manager to install this task, but instead drop the DLL into %appdata%\SAS\EnterpriseGuide\7.1\Custom (create that folder if needed). When you restart EG, it should pick it up.

      • Hi Chris,

        I did not use the Add-in manager. I followed the instruction as written in the README file.

        I could actually see the Catalogs and Format Explorer, could see the list of servers and libraries as well. This error only comes out when I double click the catalogs to view the codes.

        • Chris Hemedinger
          Chris Hemedinger on

          I rebuilt the 4.3 version, pointing to a new version of SASInterop -- not sure if it will make a difference, but give it a try. Good news -- this task will be built into the next version of SAS EG, scheduled for release in the next month or so.

Leave A Reply

Back to Top