Whether you're an independent developer or part of a larger organization, Git has been the industry standard of version control for some time now. It doesn't matter if you’re using GitHub, Bitbucket, GitLab, or a privately hosted Git server; Git is now a foundational part of most modern developer workflows.
SAS users are no exception to this. A local user group survey revealed that a significant number of community members utilize Git on a weekly basis for their data and AI projects. Among the surveyed users, many reported relying on Git to either collaborate or track changes on items such as programs, macros, model artifacts, or even deployments.
Typically, SAS users interact with Git in one of two ways: through a command-line interface (CLI) or through the point-and-click GUI in SAS Viya (here's a great article on this method). While both these approaches are superior for most use cases, when working with scheduled jobs, flows, or automated pipelines, neither is perfect.
Enter Git functions.
Git functions are exactly what they sound like: built-in SAS functions that enable you to interact with Git repositories from SAS code.
Rather than relying on manual input from an external CLI or clicking through a GUI, Git Functions let SAS programs perform common Git operations programmatically. Routine tasks like cloning a repository, pulling updates, committing files, or pushing changes can now be executed as part of a SAS program or scheduled job.
Git functions are not exclusive to SAS Viya; programmers using SAS 9.4, SAS Viya, or even the new SAS Viya Workbench all have access to Git functions. This makes them especially useful for teams working across multiple environments or even teams modernizing their workflows from SAS 9 to Viya.
Git Functions mirror some of the most commonly used Git interactions:
Since these functions run entirely within SAS code, they work best when implemented in workflows where manual Git interaction is impractical or impossible. In the next section, we will look at one of these common scenarios.
Lastly, it’s important to remember that using these Git functions does not replace traditional Git usage. Instead, they extend Git into places where SAS is already running, allowing things like version control to become a part of automated processes rather than a separate manual step.
For a complete list of available functions and syntax details, please see the Using Git Functions in SAS documentation page.
As mentioned earlier, Git functions work best in situations needing no manual intervention. While a CLI or GUI works well during active development, many workflows run on a schedule, unattended, as part of a larger automated process. Some examples include:
Consider a simple modeling workflow where a scheduled SAS program trains a model, generates an ASTORE, and updates a handful of JSON files containing supporting documentation (metrics, hyperparameters, variable importance, etc.). Each time the model is retrained on new data, some, if not all, of these files will update.
Without using Git functions, capturing those updates in a readable manner requires several manual steps outside of SAS. With Git Functions, version control can be incorporated into the same model retraining workflow that generates the associated files. A sample workflow could look like:
With this, you're left with a repeatable automated workflow where SAS not only handles the modeling but also helps to maintain a readable history of the model.
The scenario above is only a basic example of Git Functions in practice. Using the same approach in combination with other available SAS procedures, you can open the door to more advanced automations.
For example, by using GIT_DIFF in combination with other procedures, you can set internal flags based on what changed. Minor updates could be committed automatically, while more significant changes could trigger additional actions, including automated email notifications or conditional programs to run. Additionally, you could go further by having these updates tracked and visualized within a SAS Visual Analytics report.
Rather than treating Git as a separate development tool, Git functions allow SAS programs to incorporate version awareness into automated processes.
In the future, I'd love to share a real Git function-enabled repository showing how these Git-driven changes can trigger alerts, populate reports, and support more advanced monitoring workflows. In the meantime, check out the Demystifying Git articles by @Neil-Griffin and @larsarne.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.