BookmarkSubscribeRSS Feed
Brian
Obsidian | Level 7

Hi all

In SAS EG, when selecting a remote server as the Selected Sever, I understand any macros that were defined locally within that project (Selected Server Local) aren't copied/defined to the remote server.


I am interested in copying/defining these macros on the remote server without having to copy the local SAS programs w/ embedded macros to the remote server.

In SAS EG, I understand you’re able to attach a local external SAS program to the project and run that code on the server. However, if you have those embedded macros grouped by separate SAS programs, you may not use the %include statement to batch define them as they will try to reference the remote server location rather than the location of that local external SAS program.

Any thoughts?

Thanks for your help in advance.

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  In many server scenarios, there is a SASEnvironment directory on the server, with subdirectories for SASFormats, SASMacros and code snippets. If you have write access to that directory location, then you could copy your macro code to the server location and then either %INCLUDE it from there or define the location as an AUTOCALL location. But that is going to require the cooperation of your SAS Admin to give you the write (and right) access.

cynthia

Peter_C
Rhodochrosite | Level 12

to follow Cynthia's suggestion

store your macros anywhere on the server that you are allowed to write - usually there is a home folder on unix. I don't know of software that would synchronize a local windows folder (in reach of your "local" sas server) with your "remote" server, but that is the functionality which would make it all simple.

Assuming you do not have that facility, when you finish adapting a macro,  store it  not only in a folder near the "local EG server" but  also in a folder within reach of the "remote EG server".

When running in these environments, use the INSERT or APPEND system options to add the path to your macros   to the SASAUTOS option. That eliminates the need for any %include of the macros.

 

You only want to do this when EG reconnects to the server - there is an option for that

at menu: /Tools/SAS programs/

select "Submit SAS code when  server is connected"

Depending on the server use code like this

option insert= sasautos 'c:\temp\path\to\your\macros' ;

option insert= sasautos '~/your/macros' ;

If it is not server specific, you can retrieve the  &_SASSERVERNAME macro variable to enable the correct code to be selected

Patrick
Opal | Level 21

Additionally to what already has been proposed:

In case these are all Windows environments you could eventually get away by using UNC paths which then are the same both from your local and remote SAS environment. If this works then you could execute all your stuff together on either of the 2 servers.

%include '<\\SERVER\SHARE\FOLDER\FILEPATH>';

or libname ... '<\\SERVER\SHARE\FOLDER\FILEPATH>';

SAS(R) 9.2 Companion for Windows, Second Edition

If you really need to use a local and a remote session together and have them exchange stuff then you would need to have SAS/Connect licensed (using RSUBMIT) and you would have to code quite a bit to make things work.




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
  • 3 replies
  • 1950 views
  • 0 likes
  • 4 in conversation