<?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: Variable Table Name in PROC DS2 SET SQL Statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-Table-Name-in-PROC-DS2-SET-SQL-Statement/m-p/855071#M337974</link>
    <description>&lt;P&gt;I don't know what you can and cannot do in SET statement for PROC DS2.&lt;/P&gt;
&lt;P&gt;But an easy way out is to store the result of your query in a macro variable instead, prior to the PROC DS2 program.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jan 2023 12:33:56 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2023-01-23T12:33:56Z</dc:date>
    <item>
      <title>Variable Table Name in PROC DS2 SET SQL Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-Table-Name-in-PROC-DS2-SET-SQL-Statement/m-p/855069#M337972</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS EG 9.4 and currently trying out the proc ds2. What I am trying to do is to use the value from a variable as a table name in the set statement and not specifying the table name explicitly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc ds2;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; data differences (overwrite=yes);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; dcl double count_diff;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; method compareTables(char(255) inBaseTable, char(255) inCompareTable);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set {select * from (select * from inBaseTable) as base_data&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; except&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select * from (select * from inCompareTable) as compare_data};&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table names are passed to the method&amp;nbsp;compareTables, when the codes is being compiled and executed the following error message is being thrown. Apparently the variable contatining the table name is not resolved.&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="Yuriy_pbb_0-1674476501050.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79608i3198DF33966DA9EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yuriy_pbb_0-1674476501050.png" alt="Yuriy_pbb_0-1674476501050.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I use a variable instead of table name in the sql set statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 12:24:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-Table-Name-in-PROC-DS2-SET-SQL-Statement/m-p/855069#M337972</guid>
      <dc:creator>Yuriy_pbb</dc:creator>
      <dc:date>2023-01-23T12:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Table Name in PROC DS2 SET SQL Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-Table-Name-in-PROC-DS2-SET-SQL-Statement/m-p/855071#M337974</link>
      <description>&lt;P&gt;I don't know what you can and cannot do in SET statement for PROC DS2.&lt;/P&gt;
&lt;P&gt;But an easy way out is to store the result of your query in a macro variable instead, prior to the PROC DS2 program.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 12:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-Table-Name-in-PROC-DS2-SET-SQL-Statement/m-p/855071#M337974</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-01-23T12:33:56Z</dc:date>
    </item>
  </channel>
</rss>

