<?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 How to fetch data from multiple RDBMS tables and get it loaded to one common SAS table. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-fetch-data-from-multiple-RDBMS-tables-and-get-it-loaded/m-p/624089#M183778</link>
    <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a requirement to fetch data from multiple tables based on a name pattern from Oracle DB and get it loaded to SAS table. I know that we can get the exact table names by applying pattern name filter in the Oracle system table ALL_TABLES and get the TABLE_NAME value. But i don't know how to use this information in PROC SQL step to get the desired output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;Table Names:&lt;/P&gt;&lt;P&gt;Employee_20200101&lt;/P&gt;&lt;P&gt;Employee_20200109&lt;/P&gt;&lt;P&gt;Employee_20200114&lt;/P&gt;&lt;P&gt;Employee_20200202&lt;/P&gt;&lt;P&gt;Employee_20200209&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;Goes on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each tables has incremental records along with the employee details which gets updated in the respective data feed. So i need to find the list of unique Employee ID's from all the tables which starts with "Employee_" and this calculation has to go on every week when there's a new data feed coming in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex: Table 1(first week), Table 1 + Table 2(second week), Table 1 + Table 2 + Table 3 (Third week)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought of storing the table names in a macro variable ,but i don't know how to use the values from Macro variable inside an iterative statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Logic which i thought of is this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.Get the total count of tables and get it assigned to a macro variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;Ex: count=5&lt;/P&gt;&lt;P&gt;2. Find the table names and get it assigned to another macro variable&lt;/P&gt;&lt;P&gt;Ex: tablist&lt;/P&gt;&lt;P&gt;3.Include the count in the looping statement to execute the PROC SQL iteratively&lt;/P&gt;&lt;P&gt;4.Inside the PROC SQL give the macro variable tablist to execute it over and over again for all the tables and get the data loaded to SAS table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm very new to SAS and i'm finding it bit hard to translate the logic into SAS code. Could someone help me out on this? Please let me know if there are any mistakes in my requirement. I can correct and learn from the suggestions. Thanks and Have a great day&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Scott&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;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Feb 2020 06:58:46 GMT</pubDate>
    <dc:creator>Scott177</dc:creator>
    <dc:date>2020-02-12T06:58:46Z</dc:date>
    <item>
      <title>How to fetch data from multiple RDBMS tables and get it loaded to one common SAS table.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fetch-data-from-multiple-RDBMS-tables-and-get-it-loaded/m-p/624089#M183778</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a requirement to fetch data from multiple tables based on a name pattern from Oracle DB and get it loaded to SAS table. I know that we can get the exact table names by applying pattern name filter in the Oracle system table ALL_TABLES and get the TABLE_NAME value. But i don't know how to use this information in PROC SQL step to get the desired output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;Table Names:&lt;/P&gt;&lt;P&gt;Employee_20200101&lt;/P&gt;&lt;P&gt;Employee_20200109&lt;/P&gt;&lt;P&gt;Employee_20200114&lt;/P&gt;&lt;P&gt;Employee_20200202&lt;/P&gt;&lt;P&gt;Employee_20200209&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;Goes on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each tables has incremental records along with the employee details which gets updated in the respective data feed. So i need to find the list of unique Employee ID's from all the tables which starts with "Employee_" and this calculation has to go on every week when there's a new data feed coming in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex: Table 1(first week), Table 1 + Table 2(second week), Table 1 + Table 2 + Table 3 (Third week)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought of storing the table names in a macro variable ,but i don't know how to use the values from Macro variable inside an iterative statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Logic which i thought of is this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.Get the total count of tables and get it assigned to a macro variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;Ex: count=5&lt;/P&gt;&lt;P&gt;2. Find the table names and get it assigned to another macro variable&lt;/P&gt;&lt;P&gt;Ex: tablist&lt;/P&gt;&lt;P&gt;3.Include the count in the looping statement to execute the PROC SQL iteratively&lt;/P&gt;&lt;P&gt;4.Inside the PROC SQL give the macro variable tablist to execute it over and over again for all the tables and get the data loaded to SAS table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm very new to SAS and i'm finding it bit hard to translate the logic into SAS code. Could someone help me out on this? Please let me know if there are any mistakes in my requirement. I can correct and learn from the suggestions. Thanks and Have a great day&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Scott&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;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 06:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fetch-data-from-multiple-RDBMS-tables-and-get-it-loaded/m-p/624089#M183778</guid>
      <dc:creator>Scott177</dc:creator>
      <dc:date>2020-02-12T06:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch data from multiple RDBMS tables and get it loaded to one common SAS table.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fetch-data-from-multiple-RDBMS-tables-and-get-it-loaded/m-p/624396#M183936</link>
      <description>&lt;P&gt;May I suggest a much simpler approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname ORALIB oracle .... ;
data WANT;
  set ORALIB.EMPLOYEE_: indsname=SRC;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will read all the tables in order.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 02:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fetch-data-from-multiple-RDBMS-tables-and-get-it-loaded/m-p/624396#M183936</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-02-13T02:34:33Z</dc:date>
    </item>
  </channel>
</rss>

