<?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: SAS Guide - execute sql by string interpretation in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240977#M17271</link>
    <description>&lt;P&gt;One problem I can see in your code- there should be double dot after macro variable as shown below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;amp;var_val..table_oracle&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Dec 2015 03:37:26 GMT</pubDate>
    <dc:creator>RahulG</dc:creator>
    <dc:date>2015-12-28T03:37:26Z</dc:date>
    <item>
      <title>SAS Guide - execute sql by string interpretation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240794#M17262</link>
      <description>&lt;P&gt;I'm very&amp;nbsp;new at SAS Guide, and I didn't find nothing to solve my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;need to do a PROC SQL that inserts a few data into a sas table&amp;nbsp;from&amp;nbsp;an oracle table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works fine for many tables. But I have some tables that are repeated in some schemas and I would like to reuse the same program,&amp;nbsp;inputing the schema as a param.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;

SELECT VAL&amp;nbsp;INTO:var_val&amp;nbsp;FROM PARAM WHERE DESCRIPTION&amp;nbsp;= 'somevalue';

CONNECT TO ORACLE (PATH=ORACLEDB USER=XXX&amp;nbsp;PASSWORD=YYY);


INSERT INTO
&amp;nbsp; &amp;nbsp;MYTABLE
&amp;nbsp; &amp;nbsp; &amp;nbsp; (ColumnA)
&amp;nbsp; &amp;nbsp;SELECT
&amp;nbsp; &amp;nbsp; &amp;nbsp; ColumnA
&amp;nbsp; &amp;nbsp;FROM
&amp;nbsp; &amp;nbsp; &amp;nbsp; CONNECTION TO ORALCE(
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SELECT
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColumnA
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FROM
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;var_val.table_oracle
);

QUIT;&lt;/PRE&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;It doesn't work because variable &amp;amp;var_val is substituted with apostrophes. I hope that exists something like an "EXEC" command that I could tranform my&amp;nbsp;query in a complete string, and execute after&amp;nbsp;substituation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some way to do what I need?&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;thks!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Dec 2015 12:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240794#M17262</guid>
      <dc:creator>Huhufleisch</dc:creator>
      <dc:date>2015-12-24T12:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Guide - execute sql by string interpretation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240796#M17263</link>
      <description>&lt;P&gt;It should be possible with a little tweaking to the macro variable. &amp;nbsp;The basic questions (at least to start):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. What is actually in &amp;amp;VAR_VAL?&lt;/P&gt;
&lt;P&gt;2. What would the correct syntax look like after text substitution has been made, in the final FROM clause?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on your answers, it might be as simple as adding another dot (&amp;amp;var_val..table_name).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that there may be other pieces that could be automated but first let's get the error cleaned up.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Dec 2015 13:43:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240796#M17263</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-12-24T13:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Guide - execute sql by string interpretation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240849#M17264</link>
      <description>&lt;P&gt;Look at fonction &lt;STRONG&gt;dequote&lt;/STRONG&gt; to remove unwanted quotation marks (single or double) from string VAL. Use &lt;STRONG&gt;option symbolgen&lt;/STRONG&gt; to see the substituted macro strings in the code.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Dec 2015 04:58:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240849#M17264</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-12-25T04:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Guide - execute sql by string interpretation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240977#M17271</link>
      <description>&lt;P&gt;One problem I can see in your code- there should be double dot after macro variable as shown below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;amp;var_val..table_oracle&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2015 03:37:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240977#M17271</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2015-12-28T03:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Guide - execute sql by string interpretation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240995#M17274</link>
      <description>&lt;P&gt;Thanks for everyone, using double dots works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a little hard when you don't know what you should look up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using this documentation for understand how this works:&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings13/120-2013.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings13/120-2013.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2015 10:16:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Guide-execute-sql-by-string-interpretation/m-p/240995#M17274</guid>
      <dc:creator>Huhufleisch</dc:creator>
      <dc:date>2015-12-28T10:16:54Z</dc:date>
    </item>
  </channel>
</rss>

