DATA Step, Macro, Functions and more

SOURCE entry in a SAS catalog.

Posts: 29

SOURCE entry in a SAS catalog.

Hi All,

Can anyone help me in answering the below queries regarding the SOURCE entry in a SAS catalog:-

1)How to write a program to save macro definition in a SOURCE entry in a SAS catalog.

2)What are the advantages or situations for saving the macros in SOURCE entry.

Please let me know your thoughts.

kind regards,


Super User
Super User
Posts: 7,407

Re: SOURCE entry in a SAS catalog.


1) SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

2) Personally I don't see any.  Catalogs are proprietary SAS format, hence not open source.  Secondly they are not necessarily portable (32bit -> 64 bit recently for instance).  I suppoae you could argue that you can keep all your macros in one place, and keep them from be easily decoded, however I have yet to see that many macros that have a) worth, b) something that can't be done in straight code.  As for your global tool macros, your probably better off leaving them in text files so you can include them in your version control system, and easily edit/see what is happening.  Just my opinion though.

Super User
Posts: 3,112

Re: SOURCE entry in a SAS catalog.

I agree with RW9. One of the few advantages of SAS catalogs is that they can be set to read-only with a password so your macros or other SAS programs stored there cannot be changed.

It is much easier to interact with SAS catalogs in SAS Display Manager. For example the SAVE command will allow you to save a SAS program directly into a SAS catalog as SOURCE. You can also double click on a catalog SOURCE entry to view its contents.

If you don't have Display Manager and ony EG then you can't even see a catalog or list catalog entries unless you install the view catalog custom task. This task only allows you to list and delete entries not to view SOURCE entries.

Valued Guide
Posts: 3,208

Re: SOURCE entry in a SAS catalog.

1/ You can make a catalog accessible by refering to by a filename. With the dms approach you can as easily include those and export/import those as the same as it where the OS-file system.  SAS(R) 9.4 Statements: Reference, Third Edition  (filename catalog).

2/ SAS catalogs are belonging to the SAS proprierty structure types. They are getting the advantages and disadvantages of those.

As you have to manage formats FCMP and other types it could makes sense to use them in the same approach (release management and versioning) .

Versioning tools are often abused for release management with deployment and instead of simplifying the work getting it almost unworkable.

You will find a lot of SAS solutions being using catalogs. With the deployment of SAS catalogs make it less clear where and what of it is used.   
They behave different as OS dedicate type ones. Avoiding those loopholes.   

Storing macros in source code in catalogs will prevent you from upper/lowercases (only lowercase works) at the Unix level. In the classic mainframe (MVS) you are limited to a 8.8.8 PDS member naming where SAS catalogs do not have that limitation. Within a SAS/connect session you can use those remote connected (RLS) libraries transparently when in native format. Otherwise (foreign) they are readable  

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation