<?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: Preserve Comment within Macro in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211001#M4942</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you try using %STR() to mask the /* */ so that the macro doesn't "eat" them?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro xx ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %Str(/)*+ Oracle hint *%str(/)&lt;/P&gt;&lt;P&gt;%mend xx;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "%xx";&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Jun 2015 13:36:18 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-06-22T13:36:18Z</dc:date>
    <item>
      <title>Preserve Comment within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/210998#M4939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to run code in-database (Oracle) using a Hint. The code as such works BUT: The macro compiler removes the Hint as it looks like a comment (at least MPRINT doesn't print the Hint anymore).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions what I would need to change in below code example to get the Hint passed to Oracle? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro doit();&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc sql &amp;amp;cba_iem_sql_opt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; connect to oracle as con1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;amp;DBConnOpts PRESERVE_COMMENTS);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; execute&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insert &lt;STRONG&gt;/*+ append */&lt;/STRONG&gt; into target_table &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Col_A,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Col_B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from source_table &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by con1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; disconnect from con1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%doit();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jun 2015 10:13:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/210998#M4939</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-06-22T10:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Preserve Comment within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/210999#M4940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I am aware there isn't a way to pass hints to OC.&amp;nbsp; They are not actually part of the SQL at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would also question why you are uploading data directly to a DB.&amp;nbsp; My suggestion would be to create a table in a work area via passthrough.&amp;nbsp; Then have a DB function which takes this data and processes it into the database, i.e. does pre-checks, updates audit trails etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jun 2015 10:42:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/210999#M4940</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-06-22T10:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Preserve Comment within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211000#M4941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;EM&gt;As far as I am aware there isn't a way to pass hints to OC&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;It's pass-through SQL and the Oracle Hint is valid syntax. Option "&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;PRESERVE_COMMENTS&lt;/SPAN&gt;" has specifically been introduced to allow passing of hints to a data base (by not removing the Hint as a comment).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;EM&gt;I would also question why you are uploading data directly to a DB.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;I am not uploading anything. Both source and target are in Oracle (different schemas) and I want to have all of the processing in the data base. The target table is my staging table and I'm truncating it before loading any new data into it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;To ask the question I had to simplify the code. Please let's focus on my question which I believe is about the macro compiler removing the Hint as it "believes" it's a SAS comment.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jun 2015 11:17:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211000#M4941</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-06-22T11:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Preserve Comment within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211001#M4942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you try using %STR() to mask the /* */ so that the macro doesn't "eat" them?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro xx ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %Str(/)*+ Oracle hint *%str(/)&lt;/P&gt;&lt;P&gt;%mend xx;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "%xx";&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jun 2015 13:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211001#M4942</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-06-22T13:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Preserve Comment within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211002#M4943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, I didn't, but it looks like a good idea. The only thing I could think of so far is storing the whole hint in a macro variable and then use this macro variable - but I kind-of don't like the approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll give your suggestion a go once I'm on site again and will post the outcome here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jun 2015 14:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211002#M4943</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-06-22T14:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Preserve Comment within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211003#M4944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try something like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%macro hint(str) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; %nrstr(/)*+ &amp;amp;str *%nrstr(/)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%mend hint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;execute&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;(insert %hint(append) into target_table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; select Col_A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Col_B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; from source_table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;) by con1;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jun 2015 14:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211003#M4944</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-06-22T14:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Preserve Comment within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211004#M4945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With @Tom's guidance and a bit more digging I was now able to make it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There were two issues in the code:&lt;/P&gt;&lt;P&gt;1. The place I had the "by con1":&amp;nbsp; &lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/67589/HTML/default/viewer.htm#n05b4mygsvt845n1vnr6r5kchbjf.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/67589/HTML/default/viewer.htm#n05b4mygsvt845n1vnr6r5kchbjf.htm"&gt;SAS/ACCESS(R) 9.4 for Relational Databases: Reference, Sixth Edition&lt;/A&gt; &lt;/P&gt;&lt;P&gt;2. The macro compiler "eating" the hint: &lt;A href="http://support.sas.com/kb/7/290.html" title="http://support.sas.com/kb/7/290.html"&gt;7290 - Oracle hints are not passed when coded in a SAS macro&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below a code sample which would pass the hint to Oracle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro doit();&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; proc sql &amp;amp;cba_iem_sql_opt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; connect to oracle as con1&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;amp;DBConnOpts PRESERVE_COMMENTS);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; execute &lt;STRONG style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; by con1&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insert &lt;STRONG&gt;%str(/)%str(*)+ append %str(*)%str(/) &lt;/STRONG&gt;into target_table&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Col_A,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Col_B&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from source_table&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; disconnect from con1;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%doit();&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 06:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Preserve-Comment-within-Macro/m-p/211004#M4945</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-06-23T06:38:28Z</dc:date>
    </item>
  </channel>
</rss>

