<?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 Looping Variable To Multiple Output File Names in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Looping-Variable-To-Multiple-Output-File-Names/m-p/752762#M20017</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Scenario Diagram" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61051iDB138176233248CD/image-size/large?v=v2&amp;amp;px=999" role="button" title="scenario_varible_loopjpg.jpg" alt="Scenario Diagram" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Scenario Diagram&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;I am running into this tricky scenario, need your help or if you can share your experience if it is just relating a bit to this scenario.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So basically, as shown in the diagram..I have a list of variables namely ContractNo (A1,A2,etc) in the Data Job 1 and I want to push them to the Data Job 2 multiple times in order for for it to produce multiple output files with the file name including the ContractNo at the end.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I should use some sort of looping but due to my limited experience and knowledge, I have no idea where to start.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[ I am using Dataflux Data Management Studio 2.4]&lt;/P&gt;
&lt;P&gt;Thank you so much in advance.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jul 2021 02:33:08 GMT</pubDate>
    <dc:creator>jtran</dc:creator>
    <dc:date>2021-07-08T02:33:08Z</dc:date>
    <item>
      <title>Looping Variable To Multiple Output File Names</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Looping-Variable-To-Multiple-Output-File-Names/m-p/752762#M20017</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Scenario Diagram" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61051iDB138176233248CD/image-size/large?v=v2&amp;amp;px=999" role="button" title="scenario_varible_loopjpg.jpg" alt="Scenario Diagram" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Scenario Diagram&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;I am running into this tricky scenario, need your help or if you can share your experience if it is just relating a bit to this scenario.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So basically, as shown in the diagram..I have a list of variables namely ContractNo (A1,A2,etc) in the Data Job 1 and I want to push them to the Data Job 2 multiple times in order for for it to produce multiple output files with the file name including the ContractNo at the end.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I should use some sort of looping but due to my limited experience and knowledge, I have no idea where to start.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[ I am using Dataflux Data Management Studio 2.4]&lt;/P&gt;
&lt;P&gt;Thank you so much in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 02:33:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Looping-Variable-To-Multiple-Output-File-Names/m-p/752762#M20017</guid>
      <dc:creator>jtran</dc:creator>
      <dc:date>2021-07-08T02:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Looping Variable To Multiple Output File Names</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Looping-Variable-To-Multiple-Output-File-Names/m-p/752882#M20018</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's something you can try:&lt;/P&gt;
&lt;P&gt;- in your first Data Job, read the lines and count how many you have in an Expression node. User setvar function to save this in a Process Job variable. Write all records to a Worktable.&lt;/P&gt;
&lt;P&gt;- use the Global Get/Set node to set an increment counter value to -1&lt;/P&gt;
&lt;P&gt;- use the Global Get/Set node to add 1 to this value&lt;/P&gt;
&lt;P&gt;- use the If Then node to test if this counter is less than the total number of records&lt;/P&gt;
&lt;P&gt;- if yes, read a line from the Worktable and call a Data Job that reads your input file (Contract_%%ContractNo%%.txt) and writes to the output.&lt;/P&gt;
&lt;P&gt;- connect this Data Job back to the Global Get/Set node that increments the counter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am attaching a zipped version of a test job you can use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;Audrey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 14:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Looping-Variable-To-Multiple-Output-File-Names/m-p/752882#M20018</guid>
      <dc:creator>audrey</dc:creator>
      <dc:date>2021-07-08T14:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Looping Variable To Multiple Output File Names</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Looping-Variable-To-Multiple-Output-File-Names/m-p/753508#M20019</link>
      <description>Thank you so much for your help.&lt;BR /&gt;Appreciate for the bonus example &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 12 Jul 2021 14:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Looping-Variable-To-Multiple-Output-File-Names/m-p/753508#M20019</guid>
      <dc:creator>jtran</dc:creator>
      <dc:date>2021-07-12T14:38:32Z</dc:date>
    </item>
  </channel>
</rss>

