----------------------Implementing use of rsubmit & accessing values passed to it----------------------------
I am trying to write a code which will create different remote session, also it'll pass data set values to particular rsubmit blocks with the help of macros. We know that simple macro variable values cannot be sent to rsubmit statements because rsubmit creates new session. Thats why I used %syslput statement. But its not working, please tell me how can I pass data set values to the rsubmit statements using %syslput.
options sascmd='!sascmd -nosyntaxcheck' autosignon=yes sysrputsync mprint symbolgen;
data data;
input num@@;
datalines;
1 2 3
;
run;
%macro startTask(n);
%syslput number=&n;
rsubmit Task&n wait=no;
%put Output from Task&number;
%put Value of Number:=&number;
endrsubmit;
%mend;
%macro finishTask;
waitfor _ALL_ Task1 Task2 Task3;
signoff Task1;
signoff Task2;
signoff Task3;
%mend;
data _NULL_;
set data end=last;
call execute('%nrstr(%startTask('||strip(num)||'))');
run;
%finishTask
Log:------------->
1 options sascmd='!sascmd -nosyntaxcheck' autosignon=yes sysrputsync mprint symbolgen;
2 data data;
3 input num@@;
4 datalines;
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.DATA has 3 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
6 ;
7 run;
8
9 %macro startTask(n);
10 %syslput number=&n;
11 rsubmit Task&n wait=no;
12 %put Output from Task&number;
13 %put Value of Number:=&number;
14 endrsubmit;
15 %mend;
16
17 %macro finishTask;
18 waitfor _ALL_ Task1 Task2 Task3;
19 signoff Task1;
20 signoff Task2;
21 signoff Task3;
22 %mend;
23
24 data _NULL_;
25 set data end=last;
26 call execute('%nrstr(%startTask('||strip(num)||'))');
27 run;
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
26:50
NOTE: There were 3 observations read from the data set WORK.DATA.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: CALL EXECUTE generated line.
SYMBOLGEN: Macro variable N resolves to 1
ERROR: Invalid or unspecified remote session ID. Set OPTIONS REMOTE=session_id.
1 + %startTask(1)
ERROR: Remote signon canceled.
SYMBOLGEN: Macro variable N resolves to 1
MPRINT(STARTTASK): rsubmit wait=no;
NOTE: Remote signon to TASK1 commencing (SAS Release 9.02.02M2P090109).
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Copyright (c) 2002-2008 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.2 (TS2M2)
Licensed to REPORTING HOUSE, Site 70065340.
NOTE: This session is executing on the NET_ASRV platform.
NOTE: SAS initialization used:
real time 0.10 seconds
cpu time 0.07 seconds
NOTE: Remote signon to TASK1 complete.
NOTE: Background remote submit to TASK1 in progress.
SYMBOLGEN: Macro variable N resolves to 2
SYMBOLGEN: Macro variable N resolves to 2
2 + %startTask(2)
MPRINT(STARTTASK): rsubmit wait=no;
NOTE: Remote signon to TASK2 commencing (SAS Release 9.02.02M2P090109).
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Copyright (c) 2002-2008 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.2 (TS2M2)
Licensed to REPORTING HOUSE, Site 70065340.
NOTE: This session is executing on the NET_ASRV platform.
NOTE: SAS initialization used:
real time 0.09 seconds
cpu time 0.03 seconds
NOTE: Remote signon to TASK2 complete.
NOTE: Background remote submit to TASK2 in progress.
SYMBOLGEN: Macro variable N resolves to 3
SYMBOLGEN: Macro variable N resolves to 3
3 + %startTask(3)
MPRINT(STARTTASK): rsubmit wait=no;
NOTE: Remote signon to TASK3 commencing (SAS Release 9.02.02M2P090109).
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Copyright (c) 2002-2008 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.2 (TS2M2)
Licensed to REPORTING HOUSE, Site 70065340.
NOTE: This session is executing on the NET_ASRV platform.
NOTE: SAS initialization used:
real time 0.10 seconds
cpu time 0.06 seconds
NOTE: Remote signon to TASK3 complete.
NOTE: Background remote submit to TASK3 in progress.
28
29 %finishTask
MPRINT(FINISHTASK): waitfor _ALL_ Task1 Task2 Task3;
MPRINT(FINISHTASK): signoff;
NOTE: Remote submit to TASK1 commencing.
WARNING: Apparent symbolic reference NUMBER not resolved.
Output from Task&number
WARNING: Apparent symbolic reference NUMBER not resolved.
Value of Number:=&number
MPRINT(STARTTASK): endrsubmit;
NOTE: Remote submit to TASK1 complete.
NOTE: Remote signoff from TASK1 commencing.
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
real time 0.46 seconds
cpu time 0.07 seconds
NOTE: Remote signoff from TASK1 complete.
MPRINT(FINISHTASK): signoff;
NOTE: Remote submit to TASK2 commencing.
WARNING: Apparent symbolic reference NUMBER not resolved.
Output from Task&number
WARNING: Apparent symbolic reference NUMBER not resolved.
Value of Number:=&number
MPRINT(STARTTASK): endrsubmit;
NOTE: Remote submit to TASK2 complete.
NOTE: Remote signoff from TASK2 commencing.
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
real time 0.42 seconds
cpu time 0.03 seconds
NOTE: Remote signoff from TASK2 complete.
MPRINT(FINISHTASK): signoff;
NOTE: Remote submit to TASK3 commencing.
WARNING: Apparent symbolic reference NUMBER not resolved.
Output from Task&number
WARNING: Apparent symbolic reference NUMBER not resolved.
Value of Number:=&number
MPRINT(STARTTASK): endrsubmit;
NOTE: Remote submit to TASK3 complete.
NOTE: Remote signoff from TASK3 commencing.
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
real time 0.37 seconds
cpu time 0.06 seconds
NOTE: Remote signoff from TASK3 complete.
Updated macro code:
%macro startTask(n);
signon Task&n;
%syslput number=&n /remote=Task&n;
rsubmit Task&n wait=no;
%put Output from Task&number;
%put Value of Number:=&number;
endrsubmit;
%mend;