BookmarkSubscribeRSS Feed

Automating Git Workflows in SAS with Git Functions

Started yesterday by
Modified yesterday by
Views 56

 

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.

 

What are 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:

  • GIT_CLONE – clone a remote repository to a local directory
  • GIT_PULL – retrieve updates from a remote repository
  • GIT_ADD – stage files for commit
  • GIT_COMMIT – commit changes to the local repository
  • GIT_PUSH – push committed changes to a remote repository
  • GIT_DIFF – see file-level differences between commits

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.

 

 

Git Functions in Practice

 

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:

  • Scheduled jobs that update programs, reports, or documentation
  • Automated pipelines like those used for model retraining, where outputs change over time
  • Flows where individual nodes may update configuration or metadata files
  • Environments where access to a CLI is restricted or unavailable

 

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:

  1. Pull the latest version of the model/training from the remote repository
  2. Run the model training programs
  3. Find which files changed
  4. Commit updated artifacts
  5. Push the changes back to the shared model repository

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.

 

Going Further

 

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

 

 

Contributors
Version history
Last update:
yesterday
Updated by:

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

SAS AI and Machine Learning Courses

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.

Get started

Article Tags