Desktop productivity for business analysts and programmers

Copying a locally defined macro to a remote server

Reply
Occasional Contributor
Posts: 17

Copying a locally defined macro to a remote server

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.

SAS Super FREQ
Posts: 8,719

Re: Copying a locally defined macro to a remote server

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

Valued Guide
Posts: 2,174

Re: Copying a locally defined macro to a remote server

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

Respected Advisor
Posts: 3,831

Re: Copying a locally defined macro to a remote server

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.




Ask a Question
Discussion stats
  • 3 replies
  • 458 views
  • 0 likes
  • 4 in conversation