Documenting SAS Macro Programs using CATALOGS

From sasCommunity
Jump to: navigation, search


Patrick Thornton Bio at SRI Internation


From: Thornton, S. P. (2008) ‘Documenting SAS® Macro Programs using CATALOGS.’ Paper in the Proceedings of the 16th Annual Western Users of SAS® Software Conference, Universal City, California


Do you have a lot of macro programs, and sometimes forget their purpose, parameters, and/or what the parameters control? If so, more and available documentation may be the answer. This paper demonstrates the DES= option of a macro program that allows up to a 256 character description to be saved for each macro program. The paper also shows that names and descriptions of macro programs may be listed with a simple PROC PRINT or REPORT using SASHELP.VCATALG view. The SAS® System updates a record in DICTIONARY.CATALOGS each time a macro program is compiled, and VCATALG view provides easy access to the metadata. In addition, if you would like to store descriptions for each macro program that are longer than 256 characters, this paper describes a strategy and includes two macro programs that enable longer descriptions to be stored and listed.


Documentation is always a good thing, and easily accessible documentation is even better. SAS® software provides the capability to track information about macro programs. For example, the following syntax used DES= (DeVenezia, 2005) to add a short description for a trivial macro program. After the macro was compiled, a PROC PRINT was used to list the metadata maintained by SAS:

%macro print_sashelp_shoes /des='Print SASHELP.SHOES';
proc print; run;
proc print data=sashelp.vcatalg (
where=(libname='WORK' and memname='SASMACR' and objname='PRINT_SASHELP_SHOES')
) noobs;
var libname memname memtype objname objtype objdesc created;

(See the paper for more)


DeVenezia, R. A. (2005). 'SAS® Explorer: Use and Customization.' Proceedings of the Northeast SAS Users Group Conference. Portland, Maine.

Download Paper

Media: WUSS2008_COD_Thornton.pdf