I don't think it's quite as simple as saying "use version control." Would be interested to hear more about how people implement this.
So take the scenario where a company has a shared library of corporate autocall macros, and then there are multiple projects being worked on by different developers.
I'm curious @AhmedAl_Attar and @Tom , if you can say more about the setup you would propose.
Typically a shared macro library would be stored in a location accessible to all programmers. So in some directory you have /CorpMacros, which could have .sas files (or compiled macros I guess), and then users would point their code to that directory (or it would be defined in a shared config file or whatever). I think in this scenario, individual programmers would never need to check out macro code from a repo. An admin would be responsible for maintaining the code in /CorpMacros. In that setting, it's not a trivial step to roll back a macro to a prior version, because doing so would roll back the macro for every programmer in the company.
I suppose a different approach would be to keep your CorpMacros in git or whatever version control. And each project could have a local (the project) directory for storing its own collection of the CorpMacros. Meaning for each project, the programmer(s) for that project would be responsible for deciding when they want download macros from the version control storage. With that setup, each project could decide when to download an updated version of the a corporate macro. So each project would basically have its own independent copy of the corp macro library. Project A could be running %FOO v1, while Project B is running FOO v2.
I guess with the second approach, it's more work for the programmers working on the projects. But it does give them control as to which version of a corp macro is being used for their project. And makes it easier for Project B to revert to an older version of %FOO any time they want. In a sense this approach doesn't really have a corp macro library which is accessible to SAS. Instead the corp macro library is stored only in version control. And each project is responsible for maintaining a project macro library by pulling files from repository. One down side of approach #2 is that if a developer makes a critical bug fix to %foo, they then need to tell every project to make sure they pull down the latest version of the macro.
While I'm fan of corporate libraries, and I was responsible for maintaining one for years at a prior employer, I think it's a tricky task to administer properly. And as a user of corporate macros, it always felt a bit weird to know that a macro I call on Tuesday might do something different than it did on Monday, if the corp macro czar had updated it for some reason. For some critical projects, I would take a snapshot of the corp macro library and store it as a project macro library, just so that I would have control over it.
... View more