<?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: Conditional Logic in Data Integration Studio in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-Logic-in-Data-Integration-Studio/m-p/632165#M18966</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not a question or suggestion, just a comment. I had an interesting problem not long ago. A job failed in batch and gave syntax errors, but everything looked fine and worked when the job was opened and submitted in DI Studio.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error was "CARDS or DATALINES not allowed within a macro definition". The job had user-written code, where a list of constant texts was implemented as datalines in a step, but not within a macro definition. So how did a macro get into the picture?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It turned out that&amp;nbsp; somebody had decided that the job should run based on conditions, so he made another job with almost the same name, included the whole original job as a "transformation" with a conditional start-end around it, replaced the original job in the LSF flow and tested his conditional logic only, because he knew the original job worked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The list was converted to a permanent table and the conditional start-end built into the original job instead, but because of the similar names I didn't realize that is was actually another job that failed, so it took a while to figure out what was going on in a data warehouse with several thousand jobs made by a dozen developers in different departments.&lt;/P&gt;</description>
    <pubDate>Sat, 14 Mar 2020 17:01:52 GMT</pubDate>
    <dc:creator>ErikLund_Jensen</dc:creator>
    <dc:date>2020-03-14T17:01:52Z</dc:date>
    <item>
      <title>Conditional Logic in Data Integration Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-Logic-in-Data-Integration-Studio/m-p/632069#M18960</link>
      <description>&lt;P&gt;Is there a way to conditionally run a transformation in Data Integration Studio? I am working on automating overnight edit checks. However, I do not want to spam recipients if there are no edit records in a table. I am using the Publish to Email transformation to send data in a table. I see some objects in Data Integration Studio that look like there for conditional logic but I do not know how they work. I am using Data Integration Studio Version=4.902.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 20:46:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-Logic-in-Data-Integration-Studio/m-p/632069#M18960</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2020-03-13T20:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Logic in Data Integration Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-Logic-in-Data-Integration-Studio/m-p/632100#M18962</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there a way to conditionally run a transformation in Data Integration Studio? I am working on automating overnight edit checks. However, I do not want to spam recipients if there are no edit records in a table. I am using the Publish to Email transformation to send data in a table. I see some objects in Data Integration Studio that look like there for conditional logic but I do not know how they work. I am using Data Integration Studio Version=4.902.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm really pleased you're asking this question. Makes the effort for answering a question &lt;A href="https://communities.sas.com/t5/SAS-Data-Management/SAS-Di-Transformations/m-p/624735#M18778" target="_self"&gt;here&lt;/A&gt; less of a waste.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The conditional start/end transformation will give you what you're after. They simply wrap a macro around all the transformations in-between them. The condition you then define in the Conditional Start bit under the condition tab get's used for either executing the macro wrapped code or not.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In below picture of the attached sample code the condition used in node 4 is:&amp;nbsp;&amp;amp;createCSV=1&lt;/P&gt;
&lt;P&gt;Macro variable &amp;amp;createCSV gets created in node 3 with a value of either 0 or 1. Nodes 5 &amp;amp; 6 get only executed if the condition is True (if the condition is False then there is a %goto in the generated macro which simply jumps to the end of the macro).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36867iFACA611D8E95A94C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.JPG" alt="Capture1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The template code is fully working and self contained (only using WORK for storing files).&lt;/P&gt;
&lt;P&gt;Should you want to import and execute the job then the only change you need to apply is in node 8 using a valid To email address.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 244px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36868i103BEF57813BDB37/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 02:42:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-Logic-in-Data-Integration-Studio/m-p/632100#M18962</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-14T02:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Logic in Data Integration Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-Logic-in-Data-Integration-Studio/m-p/632165#M18966</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not a question or suggestion, just a comment. I had an interesting problem not long ago. A job failed in batch and gave syntax errors, but everything looked fine and worked when the job was opened and submitted in DI Studio.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error was "CARDS or DATALINES not allowed within a macro definition". The job had user-written code, where a list of constant texts was implemented as datalines in a step, but not within a macro definition. So how did a macro get into the picture?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It turned out that&amp;nbsp; somebody had decided that the job should run based on conditions, so he made another job with almost the same name, included the whole original job as a "transformation" with a conditional start-end around it, replaced the original job in the LSF flow and tested his conditional logic only, because he knew the original job worked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The list was converted to a permanent table and the conditional start-end built into the original job instead, but because of the similar names I didn't realize that is was actually another job that failed, so it took a while to figure out what was going on in a data warehouse with several thousand jobs made by a dozen developers in different departments.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 17:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-Logic-in-Data-Integration-Studio/m-p/632165#M18966</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2020-03-14T17:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Logic in Data Integration Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-Logic-in-Data-Integration-Studio/m-p/632244#M18969</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12887"&gt;@ErikLund_Jensen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A good reminder to avoid datalines/card within production worthy DIS jobs unless there is a very good reason for it.&lt;/P&gt;
&lt;P&gt;For me the only place where I might consider this is in adhoc jobs for maintenance of control tables - and these jobs are then for a BAU team only, don't get scheduled but executed directly out of DIS if any change is required. ...and I'm only using this approach on sites where I don't trust a BAU team that they will be "able" to manually maintain a config text file which a BAU adhoc job could load into a control table.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Mar 2020 10:50:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-Logic-in-Data-Integration-Studio/m-p/632244#M18969</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-15T10:50:20Z</dc:date>
    </item>
  </channel>
</rss>

