BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
klroesner
Quartz | Level 8

Hello world!

we want to use the Git-integration in SAS Enterprise Guide. So we saved all SAS Programs as .sas files under git version control and linked them to SAS Enterprise Guide projetcs. Some of the files are macros that we want to include in other programs. I've found a post with the same problem from 2016: https://communities.sas.com/t5/SAS-Programming/INCLUDE-problem-in-SAS-Enterprise-Guide/m-p/321249  Is there a better solution in the meantime? The only solution I can think of is a process flow with the name autoexec in which I link all macros. Are there any other suggestions?

 

Beste regards,

Klaus

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

Having your local git repository on a drive not accessible from your SAS server is problematic. We use git in a similar way to you except each user has a local git repository on a personal SAS server folder that is also accessible from their PCs. This is the ideal setup as users can then use EG git functions to maintain their local code repositories as well as being able to use AUTOCALL macros, %INCLUDE programs etc, from within EG. If you want to, programs can also be run in batch mode.

 

Talk to your SAS administrator about setting up git folder locations that are accessible from both PCs and your SAS server.     

View solution in original post

4 REPLIES 4
ChrisHemedinger
Community Manager

If you want to include files from a Git repo in a new SAS session, you can use the Git functions in SAS. Example:

 

options dlcreatedir;
%let repopath=%sysfunc(getoption(WORK))/wordle-sas;
libname repo "&repopath.";
data _null_;
    rc = gitfn_clone( 
      "https://github.com/sascommunities/wordle-sas", 
      "&repoPath." 
    			); 
    put 'Git repo cloned ' rc=; 
run;
%include "&repopath./wordle-sas.sas";

If your program contains SAS macros that you would like available as AUTOCALL macros, then append the path where you cloned the repo to the SASAUTOS search:

options append=(sasautos="&repopath.");

You can then use the SAS macros just as you would the built-in macros that come with SAS.

 

Working in this way has the appealing outcome (to me) of being able to start from a fresh environment, and pulling the most recent SAS program content from your Git repository of record.

 

See also: How to use Git to share your SAS programs 

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
klroesner
Quartz | Level 8

Hi Chris, thanks for the quick reply. But I think I didn't express my point very well...:-)

 

The local git repository is stored on a Windows drive at development time. The workspace server is a Linux box. We don't have any shares between Windows and Linux.

 

So I have to transfer the macros to the server before I runinng the main program.

 

These are my current solutions:

 

Version 1: Linked Objects

version1.png

 

Version 2: autoexec Processflow

version2.png

Or is there another solution?

 

Best regards,

Klaus

 

SASKiwi
PROC Star

Having your local git repository on a drive not accessible from your SAS server is problematic. We use git in a similar way to you except each user has a local git repository on a personal SAS server folder that is also accessible from their PCs. This is the ideal setup as users can then use EG git functions to maintain their local code repositories as well as being able to use AUTOCALL macros, %INCLUDE programs etc, from within EG. If you want to, programs can also be run in batch mode.

 

Talk to your SAS administrator about setting up git folder locations that are accessible from both PCs and your SAS server.     

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2129 views
  • 4 likes
  • 4 in conversation