<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: User written transformation - using rsubmit - sysrput - failing when using a conditional start in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/User-written-transformation-using-rsubmit-sysrput-failing-when/m-p/562185#M17229</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19791"&gt;@Filipvdr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*%macro etls_conditionW2W2H81N;*/
/*   %local etls_conditionTrue;*/
/*   %let etls_conditionTrue = %eval(1=1);*/
/*   %if (&amp;amp;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=&amp;amp;rtest;)');
    else call execute('%sysrput ltest=&amp;amp;rtest;');
    stop;
  run;
endrsubmit;

%put &amp;amp;=ltest;

/*---- End of User Written Code  ----*/ 

/*%exitetls_conditionW2W2H81N:*/
/*%mend etls_conditionW2W2H81N;*/
/**/
/*%etls_conditionW2W2H81N;*/
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;If you uncomment the code currently commented then you get the DIS generated code with a conditional start/end.&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 08:36:11 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2019-05-29T08:36:11Z</dc:date>
    <item>
      <title>User written transformation - using rsubmit - sysrput - failing when using a conditional start</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/User-written-transformation-using-rsubmit-sysrput-failing-when/m-p/561753#M17218</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've got the following situation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We created a user written transformation, were we use a rsubmit. in the end we want to pass information back using the sysrput.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%sysrput vasyscc = &amp;amp;syscc.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It worked for our transformation, untill we putted a conditional start in front of the transformation. After googling we changed our code to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%nrstr(%sysrput vasyscc = &amp;amp;syscc.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions or idea's?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2019 13:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/User-written-transformation-using-rsubmit-sysrput-failing-when/m-p/561753#M17218</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2019-05-27T13:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: User written transformation - using rsubmit - sysrput - failing when using a conditional start</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/User-written-transformation-using-rsubmit-sysrput-failing-when/m-p/562185#M17229</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19791"&gt;@Filipvdr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*%macro etls_conditionW2W2H81N;*/
/*   %local etls_conditionTrue;*/
/*   %let etls_conditionTrue = %eval(1=1);*/
/*   %if (&amp;amp;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=&amp;amp;rtest;)');
    else call execute('%sysrput ltest=&amp;amp;rtest;');
    stop;
  run;
endrsubmit;

%put &amp;amp;=ltest;

/*---- End of User Written Code  ----*/ 

/*%exitetls_conditionW2W2H81N:*/
/*%mend etls_conditionW2W2H81N;*/
/**/
/*%etls_conditionW2W2H81N;*/
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;If you uncomment the code currently commented then you get the DIS generated code with a conditional start/end.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 08:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/User-written-transformation-using-rsubmit-sysrput-failing-when/m-p/562185#M17229</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-05-29T08:36:11Z</dc:date>
    </item>
  </channel>
</rss>

