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.
To use the task in SAS Enterprise Guide 4.2:
- 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.
- Download the file (ZIP archive) from the support site.
- Follow the instructions in README.txt (in the archive) to make the task available for use.
- 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.
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)
That is a good suggestion, and it's on my to-do list. Just need to get a slice of time to complete it :)
I have a customer who needs exactly this and says it's a "show stopper" for moving off Display Manager and onto EG or Studio....so did you ever find the time to complete this suggestion?
I haven't yet! But it is possible to create custom tasks in SAS Studio, and it's pretty easy even for non-super-techie programmers. See all of the examples in the SAS Support Communities.
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!
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).
Pingback: 11 super-useful custom tasks for SAS Enterprise Guide - The SAS Dummy
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 -
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.
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.
Thanks Leonard -- I'll add this idea to my "backlog" and if I get to it, I'll definitely write about here.
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.
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.
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
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.
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
If the SOURCE was stored with the macro at compile time, you can retrieve it using the %COPY statement. See more about how macros are stored/retrieved in this SESUG paper from 2005.
I'm afraid there is no Readme file in the archive this morning. Help! please.
Nina, check out the example as published on my GitHub profile. If you need any more information, let me know.
Is SAS Catalog Explorer already loaded in EG 7.1? I could not find it, but again I am totally new o EG, thanks!
Nope, you have to download it and "install" it (just copy it to the correct folder), then it should show up.
this has been working fine with EG 7.1 HF1 (220.127.116.112) (32-bit). Running on the same machine with EG 7.12 HF3 (18.104.22.16844) (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!
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!
I'm a SAS EG user (7.13 HF5 (22.214.171.12486) (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!!
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.
Indeed, we are looking forward to seeing it it implemented!! :)
Pingback: Viewing SAS catalogs and formats in SAS Enterprise Guide - The SAS Dummy
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=126.96.36.199, 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!!
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.
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.
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.
Happy to say it is now working! Thanks a lot!