I'm surprised to see all the non-answers in documentation and posts regarding a simple question:
Where to store your macros??
Lots of good macros out there, maybe hundreds, thousands. Suppose we collect a fair number of them. And, maybe even write a few... or one. (so far I'm at zero)
Well, where best to keep all those macros?. (Assume Windows computer.)
How about: "D:\SAS Macros\"
And, follow-up. How then do we access one of those macros we've saved?
Thoughts greatly appreciated.
Thanks,
Nicholas Kormanik
There are a few ways to do this. The three ways that I usually mention are:
This is the topic of chapter 10 in Carpenter's Complete Guide to the SAS® Macro Language by @ArtC. Highly recommendable.
Hope this helps 🙂
There are a few ways to do this. The three ways that I usually mention are:
This is the topic of chapter 10 in Carpenter's Complete Guide to the SAS® Macro Language by @ArtC. Highly recommendable.
Hope this helps 🙂
I also recommend to set up and use the autocall facility.
Another support for the Macro autocall facility.
Know where your code is, compiles the macros when needed/used.
And, with the autocall facility, you keep your macros stored in .sas text files, preventing any troubles with SAS catalogs when you move to a different environment or upgrade SAS.
One more vote in favor of the AutoCall library.
In fact, since my Autocall library is on a server, other people in my department can access all my macros simply by including my Autocall folder in their SASAUTOS option. And I can use their macros the same way, by putting their autocall folder into my SASAUTOS. This way, if any of us add a feature or fix a bug in one of those macros, everyone gets the new feature or new bug fix immediately.
Unfortunately, at this time, this feature doesn't work across departments, people who might want to use my macros but don't have read access to the server I use can't use the macros I have written. (But, there's not a huge demand for this right now)
@Reeza I know you use Github a lot, and I never have used it. What are the advantages and disadvantages of storing macros on Github?
I suppose you cannot point the SASAUTOs option to the Github "folder" or whatever it is. Otherwise, you have to %include the desired macros in a SAS session. In my case, the way I write code, one macro calls several other macros (and I don't recall off the top of my head which macro calls which other macros), it seems as if Github isn't the solution for me, other than perhaps if I tended to move to new jobs regularly (which I don't).
Fun things like my current employer completely blocks Github and almost any "file sharing" site of any flavor. So I can't really even test the pros and cons involved.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: