BookmarkSubscribeRSS Feed
osmelbrito
Obsidian | Level 7

Hi everyone

One problem we are facing with SAS is the governance of macros (programs and variables) that we were building lately. 

We have a lot of macros and we want to inform our sas users their existence and push them to use it.  Any thoughts about it?

4 REPLIES 4
SASKiwi
PROC Star

Set your macros up in AUTOCALL libraries then add a SASAUTOS option in your SAS server's AUTOEXEC to point to these automatically for all SAS sessions:

libname OURAUTOS "OurAUTOCALLMacroLibraryFolder";
options sasautos = (OURAUTOS, SASAUTOS);

Putting your macro library first will ensure your resolve before the SAS ones.

Documenting them on a web page so it is easy for SAS users to find is worth considering.

Quentin
Super User

Agree with the autocall route and documenting the macros on a web page.

 

I wrote a paper a long time ago about automating generation of an html index of a macro library by having a standardized code header in each .sas file, and then using SAS to read in the headers and parse them and write a report via ODS HTML.  https://www.lexjansen.com/nesug/nesug04/po/po04.pdf

 

But I think rather than roll your own, you might look into something like Doxygen https://www.doxygen.nl/index.html for building documentation from code.  I think that is what @AllanBowe uses to build documentation for his macro library.  If you open any of the .sas files in https://github.com/sasjs/core/tree/main/base.  You can see the @ tags for the data in the header.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
ChrisNZ
Tourmaline | Level 20

I also find that having a help call for macros where   %macroname(help)  works for all macros,and prints a help page helps.

 

You could also write a %macrolist  macro that lists the available macros and a short description.

 

Finally, having sensible and coherent names helps too. 

ballardw
Super User

@ChrisNZ wrote:

I also find that having a help call for macros where   %macroname(help)  works for all macros,and prints a help page helps.

 

You could also write a %macrolist  macro that lists the available macros and a short description.

 

Finally, having sensible and coherent names helps too. 


There are examples of one way of accomplishing this in the SAS supplied %SGANNO macro (and the %annomac if SAS Graph is available)

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 949 views
  • 1 like
  • 5 in conversation