2
votes

I am trying to pass a local macro variable within a macro to a remote session as follows (this example assumes 'mynode has already been signed on to):

%macro mytest;

%do i = 1 %to 3;

%syslput mynewval = &i;

rsubmit mynode;

%let mynewval2 = &mynewval;
%put &mynewval2;

endrsubmit;

This looks like the correct syntax to me, however '&mynewval2' is resolving to blank when I attempt to print it to the log. Can anyone see what I am doing wrong?

Thanks

%end;
%mend;

%mytest;
1
Is this the server edition of SAS?DaJun Tian

1 Answers

1
votes

The %let mynewval2 = &mynewval; is being run on the client and not the server. IE, the local macro processor is running the code. It doesn't know what &mynewval is -- you defined it with the remote system.

Try wrapping the code inside the RSUBMIT in a macro. I don't have SAS/CONNECT licensed so I cannot test.

rsubmit mynode;

%macro run_on_server();
%let mynewval2 = &mynewval;
%put &mynewval2;
%mend;

%run_on_server();

endrsubmit;