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
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.
When you check in a .sas file containing a macro, the check-in script should be modified in such a way that it stores a copy of the file in your autocall library.
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
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
Version 2: autoexec Processflow
Or is there another solution?
Best regards,
Klaus
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.
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!
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.
Ready to level-up your skills? Choose your own adventure.