BookmarkSubscribeRSS Feed
yanamadala85
Obsidian | Level 7

I am using rsubmit method to run the Different programs parallel. I have macros at local machine, I must call macros across the remote servers (4 remove servers) without loading them in all remote servers. Same scenarios for filenames and formats usage across the remote servers which are available in local machine. 

 

How can i do the above effectively?

 

10 REPLIES 10
Reeza
Super User

I must call macros across the remote servers (4 remove servers) without loading them in all remote servers

 

 

What do you mean?

Tom
Super User Tom
Super User

After you start the remote session send it the code it needs to setup the environment you want it to have.

Might be good to place the code in a single place.

%include 'path_to_setup_code';
signon node1;
signon node2;
signon node3 ;
rsubmit node1 ;
%include 'path_to_setup_code';
endrsubmit;
rsubmit node2 ;
%include 'path_to_setup_code';
endrsubmit;
rsubmit node3 ;
%include 'path_to_setup_code';
endrsubmit;
yanamadala85
Obsidian | Level 7

below is the sample code i am using, I want to call the macro (%xyz) in all rsubmit blocks. Now i am getting the WARNING: Apparent invocation of macro XYZ not resolved error when i use in RSUBMIT blocks. how can i call the macro without write the macro in RSUBMIT blocks.

 

 

%let rc = %sysfunc( grdsvc_enable(_all_, server= SASApp_DEV));
/*signon grid1;*/
/*signon grid2;*/
options autosignon;
filename testlib "C:\Users\yanamadalavenkatesh\Desktop\SAS Parallel Execution\Rsubmit";
libname shared "%sysfunc(pathname(testlib))";
filename logfil "C:\Users\yanamadalavenkatesh\Desktop\SAS Parallel Execution\Rsubmit\ab.log" mod;
filename logfil1 "C:\Users\yanamadalavenkatesh\Desktop\SAS Parallel Execution\Rsubmit\cd.log" mod;
filename logfil2 "C:\Users\yanamadalavenkatesh\Desktop\SAS Parallel Execution\Rsubmit\ef.log" mod;
%macro xyz;
data shared.ABC;
do i= 1 to 100000;
update =rand('Uniform');
end;
run;
%mend xyz;
rsubmit grid1 wait=no inheritlib=(shared) /*NOTIFY=YES*/ log=logfil;

data shared.AB;
do i= 1 to 100000;
update =rand('Uniform');
end;
run;
%xyz;
%put &syshostname;
endrsubmit;
rsubmit grid2 wait=no inheritlib=(shared) log=logfil1 ;

data shared.CD;
do i= 1 to 100000;
update =rand('Uniform');
end;
run;
%put &syshostname;
endrsubmit;

rsubmit grid3 wait=no inheritlib=(shared) log=logfil2 ;

data shared.EF;
do i= 1 to 100000;
update =rand('Uniform');
end;
run;
%put &syshostname;
endrsubmit;

Tom
Super User Tom
Super User

You have to do something in the remote session so that it can find the macro definition. So either explicitly have it compile the macro or put the macro definition in an autocall location and have the remote session use autocall functionality to define the macro.

 

It might be possible to compile the macro into a macro store catalog in the SHARED library and tell the remote session to search that compiled macro catalog for macros.  But I find that even more complex than just giving it the code.

Reeza
Super User

how can i call the macro without write the macro in RSUBMIT blocks

 

 

You can't. You need to have the macro defined somewhat on the machine otherwise how does it know what code to run?

You could build a different macro that had an RSUBMIT within the macro but that would be a different issue. This is clearly either demo code so it may help if you explain some more what you're trying to do here besides being an training exercise. 

yanamadala85
Obsidian | Level 7

I have mstored compiled macro catalogs in the location "\\C:shared".

each macro do different functionality (like, ISO date conversion, formats creation, some calcuctions etc.)

 

I have some 20 programs available in another location "\\C:Programs".

 

Now i need to write a macro which can run programs (available in "\\C:Programs"). some times i have to use macro catalogs which are available in  "\\C:shared" location (means, need to call those macros in rsubmit blocks).

 

Example code:

%let rc = %sysfunc( grdsvc_enable(_all_, server= SASApp_DEV));
options autosignon;
filename testlib "C:\Users\yanamadalavenkatesh\Desktop\SAS Parallel Execution\Rsubmit";
libname shared "%sysfunc(pathname(testlib))";

rsubmit grid1 wait=no inheritlib=(shared) /*NOTIFY=YES*/ log=logfil;

%formatds;  **Catalog is available in  \\C:shared location;

%include "\\C:Programs\dm.sas";
endrsubmit;

 

rsubmit grid2 wait=no inheritlib=(shared) /*NOTIFY=YES*/ log=logfil;

%isodt;  **Catalog is available in  \\C:shared location;

%include "\\C:Programs\lb.sas";
endrsubmit;

 

My question is, how can I use those catalogs (Means, How can i call those macros) in RSUBMIT blocks. Can you provide the sample code for the same.

Patrick
Opal | Level 21

@yanamadala85

Your locally compiled macros are available to your local SAS session but NOT to your remote GRID environment. 

You need to compile the macros in your GRID environment (as code during run-time directly in your rsubmit blocks, store the macro code in a folder defined as part of the SAS AUTOCALL facility (Grid server side) or compile it on the Grid into a Macro catalog which is part of the SASAUTOS search path).

 

In case there is a folder location accessible from both your local environment and your Grid environment (unlikely but possible) then you can maintain a single code source else you will have to replicate your macro code.

 

Reeza
Super User

@yanamadala85 wrote:

 

 

My question is, how can I use those catalogs (Means, How can i call those macros) in RSUBMIT blocks. Can you provide the sample code for the same.


Running a code on a server/grid/batch means that it sees NOTHING on your computer unless you explicitly specify it. It's literally a different computer and can't see the catalog UNLESS you somehow make that accessible to your server/grid.

Tom
Super User Tom
Super User

@yanamadala85 wrote:

I have mstored compiled macro catalogs in the location "\\C:shared".

each macro do different functionality (like, ISO date conversion, formats creation, some calcuctions etc.)

... 

 

Sounds like you already know how to access stored macro catalogs. Just do the same thing in each of the remote sessions.

yanamadala85
Obsidian | Level 7

Thanks to all. that is true. I shall try the same.

 

 I have another question, How can I access work libraries across the grids and local machine, without defining the same location for all servers work libraries?.

 

1. Local work library in Remote machine.

2. Remote work library in Local machine

3. One Remote work library in another remote machine

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 10 replies
  • 2858 views
  • 2 likes
  • 4 in conversation