BookmarkSubscribeRSS Feed

Git and SAS - some tools (papers, posts, and BLOGS) that can help you "git" started

Started ‎12-31-2021 by
Modified ‎01-02-2022 by
Views 4,180

One of my favorite rock and roll guitar heroes many times has stated something to the effect that very little that we come up with is “new”.  That is, whether it is a guitar riff or song lyrics or a whole music genre, what is considered “new” is based upon what came before it – maybe presented in a new way or in a new context.  It is true in music and in many other areas.  And, of course, technological advances provide many opportunities to implement new approaches to “old” ways.

 

Take repository management, version control, and collaboration as part of the SAS software development process.  Organizations that extensively leverage SAS have utilized or developed comprehensive systems to hold and manage their SAS assets – programs, logs, datasets, output, models, projects, and more.  Yet along comes Git - a “new” way of managing SAS assets that offers advantages over existing methods – and SAS organizations are now embracing Git as a powerful tool for management of their valuable SAS content.

 

So, before I jump in to highlight some of the ways that SAS organizations are using Git, I will provide a definition.  According to Wikipedia: Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.  This is a good, short definition.  But my Google search on “what is Git” provided over 2.6 billion hits!  so, there are a few other good definitions 😊

 

I will also make a couple of admissions.  First, I am a relative Git novice.  I do demonstrate how SAS Enterprise Guide (version 8.2+) and SAS Studio (versions 3.8 and version 5.2+) integrate with Git on a very frequent basis.  In this context, through these integration points, Git provides a powerful repository management tool for SAS programmers – to provide version control, collaboration and organization of their SAS assets – programs, logs, datasets, output, and more. What makes Git great in this context, where assets like programs and logs are text files, is that differencing between different versions can easily be seen.  For example, Git can identify program lines that have been added, deleted, or modified between different versions of a program.  And with direct integration into the development interfaces of SAS Enterprise Guide and SAS Studio, SAS programmers can see this differencing right from within SAS.

 

But I do not program in SAS several hours each day like many of our users do.  So, I admittedly do not use Git in a production environment and see its benefits in “the real world” of our customers and users.  Nor do I know all of the different types of SAS assets that organizations are managing with Git repositories, nor the processes they are using with their SAS development teams to manage their content in Git repositories.

 

So, you might ask – what do I wish to contribute here to this topic?  Why should you read this post?  First, I want to point you to interesting and helpful papers, and posts that can provide you with diverse examples on how to manage SAS content with Git.  Second, I hope that this post will generate comments where users can share other ways they are using Git with SAS.   Third, I want to use this post as an initial post on the topic – where in future posts I can provide use case based, technical  examples to share. 

 

Of course, it goes without saying, that documentation can provide you with a good starting point in using Base SAS functions with Git or understanding the Git integration capabilities provided by the latest versions of SAS Enterprise Guide and SAS Studio.  Here, though, I will point you to papers and postings that I have found very useful in my initial work with SAS and Git.

 

If you are a SAS programmer who is using the Display Management System in SAS or an older version of SAS Enterprise Guide or SAS Studio, then this paper “An Introduction to Git Version Control for SAS Programmers” by  Stephen Philp, Pelican Programming, Redondo Beach, CA  (https://www.lexjansen.com/wuss/2012/94.pdf) is a very good paper.  It is an older paper – so it highlights the advantages of using Git as a repository for SAS Content using Git Bash commands and an easily reproducible example.  In fact, the example is so good that I use it to demonstrate the integration of Git within SAS Enterprise Guide and SAS Studio in knowledge transfer sessions with customers.

 

Another very good paper is “SAS Global Forum Paper SAS® FUNCTIONS TO DRIVE SOURCE CONTROL WITH Git” by Danny Zimmerman, SAS Institute Inc. Cary, NC  https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3057-2019.pdf .  This paper highlights how to use Base SAS Git functions (available starting in SAS9.4 M6) in programs to manage SAS content in a Git Repository for file versioning, collaboration, and management.  I have used this paper, with its examples, to better understand how to use these functions.

 

For understanding the capabilities of and how to use Git from within SAS Studio and SAS Enterprise Guide recent versions this SAS 2020 Global Forum Paper “Git for the SAS® Programmer: Using Source Control to Organize Your Code and Collaborate with Others” by Amy Peters, Danny Zimmerman, Grace Whiteis, Joe Flynn, and Stan Polanski, SAS Institute Inc.   https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2020/4197-2020.pdf is a good one of several. 

 

And this entry from Chris Hemedinger in his “The SAS Dummy” BLOG provides very good tips and best practices for using Git with SAS in general and through Git integration with SAS Studio and SAS Enterprise Guide:  https://blogs.sas.com/content/sasdummy/2020/11/10/sas-projects-Git/ 

 

See also this video tutorial from Chris:

 

But the uses and value of Git with SAS go beyond version control and collaboration of SAS programs and related assets.  Here are three very different examples of how Git can be used with SAS:  

 

First, as an integrated component of the DevOps process.  This SAS Communities posting highlights how the use of Git as a repository for SAS code and content to be used to trigger further steps in the DevOps process: “DevOps Applied to SAS 9: SAS Code, GitLab and Jenkins ” https://communities.sas.com/t5/SAS-Communities-Library/DevOps-Applied-to-SAS-9-SAS-Code-GitLab-and-J...  I always like simple illustrative examples that I can try and learn from.  The example here shows how changes to code in a Git repository where the Jenkins automation server can incorporate and execute the changed code.

 

Second, as a migration tool.  The SAS Global Forum 2020 Paper “Git it? Got it? Good: Migrating from SAS® to SAS® Viya® Using Git” by Cameron Estroff and Weston McManus, SAS Institute Inc.  https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2020/5194-2020.pdf shows how to create a simple process using Git with built-in integration with SAS Enterprise Guide and SAS Studio to migrate your SAS9 code and related assets to Viya.

 

Third, using “Git as a SAS Model Manager Publishing Destination” as described in these SAS Communities postings that illustrate how one can easily publish models from SAS Model Manager to a local Git Repository (release SAS Viya 2020.1.1 and stable release 2021.1.4)

 

It is also worth noting that each of these papers and postings provides great additional materials on topics related to Git, its integration with SAS, and its value to organizations that leverage SAS.

 

In summary, I, as someone fairly new in the world of Git, have provided a perspective that is helpful for you if you are starting out on this Git journey.   And I hope that some of the papers and posts that I highlight above – the ones that have helped me – can be of help to you. 

Comments

Thanks for sharing!  

For those developers who come more from a 'terminal GIT' background, or who like to code in other IDEs such as VS Code, there is (yet) another approach to using GIT with SAS - where your SAS code is stored in a LOCAL checkout of a repository.  

 

With this approach you are free to choose your GIT client, your editor, and still work with SAS (Base, Metadata or Viya) WITHOUT having SAS stored on your local machine.  This is great for a DevOps setup where your build is happening in a vanilla linux session such as a pipeline or github action.


More information on this approach is available below:

 

Version history
Last update:
‎01-02-2022 09:01 AM
Updated by:

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags