Hello experts,
I've got the following situation:
We created a user written transformation, were we use a rsubmit. in the end we want to pass information back using the sysrput.
%sysrput vasyscc = &syscc.
It worked for our transformation, untill we putted a conditional start in front of the transformation. After googling we changed our code to:
%nrstr(%sysrput vasyscc = &syscc.);
Now it works if we have a conditional start in front of the transformation... but it doesn't work anymore if we have no conditional start.
Any suggestions or idea's?
You face all sorts of timing issues when combining SAS Macro code with RSUBMIT which require quoting to resolve. I guess you know that already given the current solution you found.
The problem is that the DIS conditional Start/End does exactly that: It wraps a macro around everything in its middle. What you need to do is to write your RSUBMIT code "macro sensitive" - so different code bits need to execute depending whether the RSUBMIT is wrapped into a SAS macro or not.
You could use a conditional start/end generated macro to determine if your code is "macro wrapped" or not. Below sample code uses DIS generated code and works inside and outside the cond start transformations.
/*%macro etls_conditionW2W2H81N;*/
/* %local etls_conditionTrue;*/
/* %let etls_conditionTrue = %eval(1=1);*/
/* %if (&etls_conditionTrue=0) %then*/
/* %do;*/
/* %put ETLS_DIAG: Condition flow did NOT execute, condition was 1=1;*/
/* %goto exitetls_conditionW2W2H81N;*/
/* %end;*/
/* %else*/
/* %do;*/
/* %put ETLS_DIAG: Condition flow did execute, condition was 1=1;*/
/* %end;*/
/*---- Start of User Written Code ----*/
options autosignon=yes sascmd= "!SASCMD";
rsubmit test;
data _null_;
call symputx('rtest','ABC');
stop;
run;
data _null_;
if symexist("etls_conditionTrue") then call execute('%nrstr(%sysrput ltest=&rtest;)');
else call execute('%sysrput ltest=&rtest;');
stop;
run;
endrsubmit;
%put &=ltest;
/*---- End of User Written Code ----*/
/*%exitetls_conditionW2W2H81N:*/
/*%mend etls_conditionW2W2H81N;*/
/**/
/*%etls_conditionW2W2H81N;*/
If you uncomment the code currently commented then you get the DIS generated code with a conditional start/end.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.