BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
derrick
Calcite | Level 5

Here is my macro in SAS 9.3:

%LET GERC=%SYSFUNC( GrdSvc_Enable(_all_,resource=&SASAppSvr.));

%PUT GERC=&GERC.;

OPTIONS noSYMBOLGEN signonwait noMPRINT noMLOGIC NOTES COMPRESS=NO NOFULLSTIMER NOERRORABEND noMFILE;

LIBNAME dissert "*\DATA\";

%MACRO gridsubmit;

%LET tnum=1;

PROC PRINTTO LOG="*\LOGS\grid_enable.log" NEW;

RUN;

%DO start=1 %TO 981 %BY 20;

    SIGNON task&tnum;

    %SYSLPUT start=&start;

    %SYSLPUT tnum=&tnum;

    RSUBMIT task&tnum WAIT=NO PERSIST=NO;

    %PUT Session started on grid node %sysfunc( grdsvc_getname( task&tnum));

    OPTIONS noSYMBOLGEN noMPRINT noMLOGIC noNOTES COMPRESS=NO NOFULLSTIMER noERRORABEND noMFILE;

   

    LIBNAME dissert "*\DATA\";

    LIBNAME simulate "*\DATA\simulated\";

    %INCLUDE "*\mod_defs ND v21.sas";

    %INCLUDE "*\optimization ND v21.sas";

    %INCLUDE "*\M_step ND v17.sas";

    %INCLUDE "*\macro simulation wl v2.sas";

    %INCLUDE "*\hazard.sas";

    %simulations (

    numsims=20,

    startwhere=&start,

    results=dissert.output&tnum,

    K=3,

    P=2,

    dset1=simulate.testlong,

    dset2=simulate.testwide,

    num_nodes=12,

    convcrit=1E-4,

    varcrit=1E-15,

     shft=1,

    limit=4500,

    limit2=200,

    non=1 1 1,

    sg=1)

    ENDRSUBMIT;

    %LET tnum=%EVAL(&tnum+1);

%END;

WAITFOR _ALL_ %DO tnum=1 %TO 50; task&tnum %END; ;

SIGNOFF _ALL_;

data dissert.output;

set %DO tnum=1 %TO 50; dissert.output&tnum %END;;

run;

%MEND gridsubmit;

%gridsubmit;

%*LET num=%sysfunc(grdsvc_nnodes(server=&SASAppSvr)); %PUT #

%*LET rc=%sysfunc(grdsvc_getinfo(_ALL_)); %PUT &rc;

After running I get connection to the first task then every task thereafter I get the same warning:

NOTE: Remote signon to TASK1 complete.

NOTE: Background remote submit to TASK1 in progress.

NOTE: Remote submit to TASK1 commencing.

Session started on grid node *

ERROR: A link to TASK2 does not exist; execute SIGNON to establish the link.

Session started on grid node

WARNING: The value for variable START has been overridden due to interleaving SYSLPUT with

         asynchronous remote processing.

WARNING: The value for variable TNUM has been overridden due to interleaving SYSLPUT with

         asynchronous remote processing.

1 ACCEPTED SOLUTION

Accepted Solutions
derrick
Calcite | Level 5

Skipping the rsubmit macro entirely, writing another macro with PUT statements to write the entire program with 50 rsubmits to another file.  Problem solved.

View solution in original post

16 REPLIES 16
Tom
Super User Tom
Super User

Try telling it which session to put the variables into.

SIGNON task&tnum;

    %SYSLPUT start=&start /remote=task&tnum;

    %SYSLPUT tnum=&tnum /remote=task&tnum;

derrick
Calcite | Level 5

that solved the warning but not the error.

ERROR: A link must be established by executing the SIGNON command before you can communicate with

       TASK2.

ERROR: A link must be established by executing the SIGNON command before you can communicate with

       TASK2.

ERROR: A link to TASK2 does not exist; execute SIGNON to establish the link.

Session started on grid node

ERROR: A link must be established by executing the SIGNON command before you can communicate with

       TASK3.

ERROR: A link must be established by executing the SIGNON command before you can communicate with

       TASK3.

Tom
Super User Tom
Super User

Sounds like your SIGNON is not finishing before your %SYSLPUT is running?

Another thing that I have had to use is to revert to using the old SAS 6.12 style macro for pushing macro values into the remote session.

Here is a %MSYSLPUT() macro to do that.

%macro msyslput

/*----------------------------------------------------------------------

Send value to remote macro variable while running inside a local macro

----------------------------------------------------------------------*/

(macvar   /* Name of remote macro variable to set */

,macval   /* Value to assign to remote macro variable */

,remote   /* (Optional) Name of remote session to send to */

);

/*----------------------------------------------------------------------

When trying to set remote macro variables within a local macro execution

SAS can get confused with timing and execution.  Reverting to using this

older method fixes that issue.

Based on SAS 6.12 autocall macro SYSLPUT that existed before SAS added

the %SYSLPUT macro statement.

----------------------------------------------------------------------*/

%local str ;

%let str=%str(rsubmit &remote;)%nrstr(%let) %str(&macvar = &macval;endrsubmit;);

&str.

%mend msyslput;

SASKiwi
PROC Star

What happens if you use the REMOTE = option on SYSLPUT as explained here:

http://support.sas.com/kb/40/924.html


Peter_C
Rhodochrosite | Level 12

Perhaps related to "asynchronous" remote session management.

And possibly not.

I think you'll solve the problem by removing the SIGNON into a preliminary loop.

Afterthought addeded by: Peter

derrick
Calcite | Level 5

The SIGNON loop worked for the connection.

The /REMOTE option appeared to work but now the macro variables do not resolve so the RSUBMIT goes nowhere

Tom
Super User Tom
Super User

You will need to stop using %SYSLPUT statement and use the old %NRSTR() trick, either via a utility macro or just using you ow local macro variable.

See this thread from last year.

https://communities.sas.com/thread/38251?start=0&tstart=0

Peter_C
Rhodochrosite | Level 12

did you include the syslput statements in the signon loop?

If so, you might need to add also a synchronous connect rsub to ensure that the macro values have landed

derrick
Calcite | Level 5

no they are not in the loop.  I used the remote=option.  Now that you mention it, there is not /remote option for %SYSLPUT in 9.2.....

derrick
Calcite | Level 5

Sorry about the confusion, the remote server I'm using is 9.2 not 9.3.  Using lots of servers and different versions, got mixed up.

derrick
Calcite | Level 5

Here is my current program.  Looks like the first RSUBMIT works fine but after that I get:

2940   RSUBMIT task&loop WAIT=NO PERSIST=NO;

ERROR: Unrecognized option, &.

ERROR: Remote submit canceled.

%MACRO gridsubmit;

%DO loop=1 %TO 41 %BY 20;

    SIGNON task&loop SIGNONWAIT=Y;

    %SYSLPUT start=&loop;   

%END;

%DO loop=1 %TO 41 %BY 20;   

    RSUBMIT task&loop WAIT=NO PERSIST=NO;

    %NRSTR(%%)PUT Session started on grid node %sysfunc( grdsvc_getname( task&start));

    OPTIONS noSYMBOLGEN noMPRINT noMLOGIC noNOTES COMPRESS=NO NOFULLSTIMER noERRORABEND noMFILE;

   

    LIBNAME dissert "\\\DATA\";

    LIBNAME simulate "\\\DATA\simulated\";

    %INCLUDE "\\\mod_defs ND v21.sas";

    %INCLUDE "\\\optimization ND v21.sas";

    %INCLUDE "\\\M_step ND v17.sas";

    %INCLUDE "\\\macro simulation wl v2.sas";

    %INCLUDE "\\\hazard.sas";

    %simulations (

    numsims=1,

    startwhere=&start,

    results=dissert.output&start,

    K=3,

    P=2,

    dset1=simulate.testlong,

    dset2=simulate.testwide,

    num_nodes=12,

    convcrit=1E-4,

    varcrit=1E-15,

     shft=1,

    limit=4500,

    limit2=200,

    non=1 1 1,

    sg=1)

    ENDRSUBMIT;

   

%END;

WAITFOR _ALL_ %DO start=1 %TO 41 %BY 20; task&start %END; ;

SIGNOFF _ALL_;

data dissert.output;

set %DO start=1 %TO 41 %BY 20; dissert.output&start %END; ;

run;

%MEND gridsubmit;

derrick
Calcite | Level 5

Only the first Rsubmit runs.  Looks like I need to abandon this macro and explicitly call the 50 RSUBMITS.  Any suggestions on how to automate this process?

Tom
Super User Tom
Super User

2940   RSUBMIT task&loop WAIT=NO PERSIST=NO;

ERROR: Unrecognized option, &.

This looks like a parser mistake.  Either create another macro variable to contain the value of the task name.

%let task=task&loop;

rsubmit &task ... ;

Or use %UNQUOTE()

rsubmit %unquote(task&loop) ....

derrick
Calcite | Level 5

Skipping the rsubmit macro entirely, writing another macro with PUT statements to write the entire program with 50 rsubmits to another file.  Problem solved.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 16 replies
  • 5124 views
  • 6 likes
  • 5 in conversation