<?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: PROC SQL - using CONTAINS and Variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463159#M117950</link>
    <description>hmmm, okay. thank you for that.</description>
    <pubDate>Thu, 17 May 2018 20:55:44 GMT</pubDate>
    <dc:creator>EbethF</dc:creator>
    <dc:date>2018-05-17T20:55:44Z</dc:date>
    <item>
      <title>PROC SQL - using CONTAINS and Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463135#M117937</link>
      <description>&lt;P&gt;hello, I am struggling with syntax for my PROC SQL statement. I am pulling data from a very large database table from an ODBC link, and want to specify records based on the first two letters of a text field.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt; &lt;STRONG&gt;SQL&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CONNECT TO ODBC (DSN='CFD' USER=sa PWD=Password);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CREATE TABLE SRORD_DETAIL AS SELECT * FROM CONNECTION TO ODBC (select SRORD_DET_ID,SRORDER_ID,LINE_NUMBER,&lt;/P&gt;&lt;P&gt;PROD_ID, PACKSIZE_ID, QTTY_ORDERED, COMMENT,&lt;/P&gt;&lt;P&gt;CUSTOMER_KEY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FROM&amp;nbsp;SRORD_DETAIL&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;where CUSTOMER_KEY CONTAINS ‘OR’ );&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't seem to make the last WHERE statement work for syntax, I get this error:&lt;/P&gt;&lt;P&gt;ERROR: CLI describe error: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'CONTAINS'. :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.&lt;/P&gt;&lt;P&gt;(example of a record I want to keep in the image attached.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;help appreciated!&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="srord.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20602i31D81BC27B464455/image-size/large?v=v2&amp;amp;px=999" role="button" title="srord.JPG" alt="srord.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 20:11:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463135#M117937</guid>
      <dc:creator>EbethF</dc:creator>
      <dc:date>2018-05-17T20:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - using CONTAINS and Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463143#M117941</link>
      <description>&lt;P&gt;Did you try&amp;nbsp;&lt;SPAN&gt;where CUSTOMER_KEY like 'OR%'&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 20:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463143#M117941</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-05-17T20:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - using CONTAINS and Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463157#M117948</link>
      <description>&lt;P&gt;Note:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;select SRORD_DET_ID, SRORDER_ID, LINE_NUMBER, PROD_ID, PACKSIZE_ID, QTTY_ORDERED, COMMENT, CUSTOMER_KEY&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;FROM SRORD_DETAIL&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;where CUSTOMER_KEY CONTAINS ‘OR’&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in your code is NOT a &lt;STRONG&gt;proc SQL&lt;/STRONG&gt; query. It is a query that is transmitted by proc SQL to your&amp;nbsp;SQL Server.&amp;nbsp;It must obey the syntax rules of SQL Server.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 20:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463157#M117948</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-05-17T20:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - using CONTAINS and Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463159#M117950</link>
      <description>hmmm, okay. thank you for that.</description>
      <pubDate>Thu, 17 May 2018 20:55:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463159#M117950</guid>
      <dc:creator>EbethF</dc:creator>
      <dc:date>2018-05-17T20:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - using CONTAINS and Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463173#M117956</link>
      <description>&lt;P&gt;thanks to both of you, a hybrid of those hints worked with this:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SQL&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CONNECT&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ODBC (DSN=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'CFD'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; USER=sa PWD=Password);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CREATE&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TABLE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SRORD_DETAIL &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AS&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SELECT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; * &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;FROM&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CONNECTION TO ODBC(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SRORD_DET_ID,SRORDER_ID,LINE_NUMBER,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROD_ID,&lt;/P&gt;&lt;P&gt;PACKSIZE_ID,&lt;/P&gt;&lt;P&gt;QTTY_ORDERED,&lt;/P&gt;&lt;P&gt;COMMENT,&lt;/P&gt;&lt;P&gt;CUSTOMER_KEY&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; srord_detail&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT face="Courier New" size="3"&gt;WHERE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CUSTOMER_KEY &lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;LIKE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;'OR%'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/FONT&gt;&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;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 21:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463173#M117956</guid>
      <dc:creator>EbethF</dc:creator>
      <dc:date>2018-05-17T21:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - using CONTAINS and Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463290#M118017</link>
      <description>&lt;P&gt;SQL Server does not have the CONTAINS operator like SAS SQL. To get the same result as with SAS "contains 'OR'" you will have to use "like '%OR%'". But it sounds like using "like 'OR%'" gives you what you want, so you should probably use that, as it is much faster.&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 12:23:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-CONTAINS-and-Variables/m-p/463290#M118017</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-05-18T12:23:12Z</dc:date>
    </item>
  </channel>
</rss>

