<?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: Data Merge Dynamically in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/279297#M56274</link>
    <description>&lt;P&gt;Well, I would say that creating multiple datasets in a previous step is a bad idea straight away - hence why you now have this issue. &amp;nbsp;Generally speaking there is rarely a need to split datasets, just assign a grou value and then do processing as a by group. &amp;nbsp;Simplifies coding, makes maintenance easier, and makes further coding simpler.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now if all your datasets have DATA_P prefix, then you could use that:&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set data_p:;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2016 12:24:22 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-06-22T12:24:22Z</dc:date>
    <item>
      <title>Data Merge Dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/279292#M56272</link>
      <description>&lt;P&gt;I have this code&amp;nbsp;and it&amp;nbsp;works well (hard coded);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/* Merge Data Tables */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data all_months;&lt;/P&gt;&lt;P&gt;SET data_P1, data_P2 data_P3 data_P4 data_P5 data_P6;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;data tables&amp;nbsp;are&amp;nbsp;built using&amp;nbsp;with a do loop macro based on a&amp;nbsp;user entry&amp;nbsp;of 6 (six periods).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to dynamically be able to&amp;nbsp;enter 6 or 12 or 14 or 24&amp;nbsp;periods and build&amp;nbsp;this data Merge&amp;nbsp;code for the "SET" portion to accomodate the&amp;nbsp;different period options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I use the number of user entered periods to build the merge statement dynamically?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kody_Devl&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 12:12:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/279292#M56272</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-06-22T12:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: Data Merge Dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/279297#M56274</link>
      <description>&lt;P&gt;Well, I would say that creating multiple datasets in a previous step is a bad idea straight away - hence why you now have this issue. &amp;nbsp;Generally speaking there is rarely a need to split datasets, just assign a grou value and then do processing as a by group. &amp;nbsp;Simplifies coding, makes maintenance easier, and makes further coding simpler.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now if all your datasets have DATA_P prefix, then you could use that:&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set data_p:;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 12:24:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/279297#M56274</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-22T12:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Data Merge Dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/279299#M56275</link>
      <description>&lt;P&gt;First, you are appending, not merging.&lt;/P&gt;
&lt;P&gt;Then, you need to build macro logic for this. Perhaps with a %DO loop to generate the data set names dynamically on the SET statement.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 12:25:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/279299#M56275</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-06-22T12:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Data Merge Dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/279309#M56282</link>
      <description>&lt;P&gt;Given that you follow the naming convention you indicated for your data set names ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given that you always want a consecutive set of months ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;there is no need to do any complicated programming.&amp;nbsp; SAS has already built the capabilities for you.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set data_P7 - dataP_24;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 13:04:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/279309#M56282</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-06-22T13:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Data Merge Dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/280458#M56680</link>
      <description>&lt;P&gt;This works beautifully.&amp;nbsp; I just pass in &amp;amp;FPer and &amp;amp;LPer and it is now automaitc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kody_Devl&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 15:29:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Merge-Dynamically/m-p/280458#M56680</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-06-27T15:29:40Z</dc:date>
    </item>
  </channel>
</rss>

