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 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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