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

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 

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
klroesner
Obsidian | Level 7

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.     

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1073 views
  • 4 likes
  • 4 in conversation