<?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 DS2 ERROR: Syntax error at or near &amp;quot;CONTAINS&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623869#M183722</link>
    <description>&lt;P&gt;The problem that DS2 is integrated with FedSQL, not PROC SQL, and FedSQL is significantly more strict about ANSI expressions - it has very few SAS extensions, and the CONTAINS operator is one of these. Specifically:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt; on strip(upcase(matsc.OCCUPATION_DESC)) &lt;FONT color="#FF0000"&gt;CONTAINS&lt;/FONT&gt; strip(upcase(SPMF.OCCUPATION))&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;or strip(upcase(matsc.OCCUPATION_DESC))&amp;nbsp;&lt;FONT color="#FF0000"&gt;CONTAINS&lt;/FONT&gt; strip(upcase(SPMF.STANDARD_PROFESSION))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Instead of the SAS-specific CONTAINS operator, use the ANSI LIKE operator. Something like this should work for you:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;thread newton/overwrite=yes;
   method run();
	   SET {Select distinct matsc.*,SPMF.Final
              from Maturity_score matsc 
              left join 
              OCCUPATION_XREF_MAP SPMF 
              on    strip(upcase(matsc.OCCUPATION_DESC)) like '%'||strip(upcase(SPMF.OCCUPATION))||'%' 
                 or strip(upcase(matsc.OCCUPATION_DESC)) like '%'||strip(upcase(SPMF.STANDARD_PROFESSION))||'%'
           }
; /* Ability to use FedSql query within DS2 */
end;
endthread;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Feb 2020 15:08:07 GMT</pubDate>
    <dc:creator>SASJedi</dc:creator>
    <dc:date>2020-02-11T15:08:07Z</dc:date>
    <item>
      <title>PROC DS2 ERROR: Syntax error at or near "CONTAINS"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/616246#M181791</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Greetings of the day and happy new year to all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was trying to execute the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ds2;
	thread newton/overwrite=yes;
			method run();
			SET {Select distinct matsc.*,SPMF.Final
from Maturity_score matsc left
join OCCUPATION_XREF_MAP SPMF on 
strip(upcase(matsc.OCCUPATION_DESC)) contains strip(upcase(SPMF.OCCUPATION)) or strip(upcase(matsc.OCCUPATION_DESC)) contains strip(upcase(SPMF.STANDARD_PROFESSION))}; /* Ability to use FedSql query within DS2 */

				end;

	endthread;
data Employment_Score/overwrite=yes;
		dcl thread newton frac2; /* Declare an Instance of the newton thread */

		method run();
			set from frac2 threads=4; /* &amp;lt;--- You Change the number of threads to control the threaded reads */
		end;
	enddata;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;P&gt;ERROR: Compilation error.&lt;BR /&gt;ERROR: Syntax error at or near "CONTAINS"&lt;BR /&gt;ERROR: Line 28: Unable to prepare SELECT statement for table {Select distinct matsc.*,SPMF.Final from Maturity_score matsc left &lt;BR /&gt;join OCCUPATION_XREF_MAP SPMF on strip(upcase(matsc.OCCUPATION_DESC)) contains strip(upcase(SPMF.OCCUPATION)) or &lt;BR /&gt;strip(upcase(matsc.OCCUPATION_DESC)) contains strip(upcase(SPMF.STANDARD_PROFESSION))} (rc=0x80fff802U).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above code is running fine in normal Proc sql scope, but in proc Ds2 it's throwing error. Is it something like we can't use contains function in FedSql query inside proc DS2?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 20:09:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/616246#M181791</guid>
      <dc:creator>rajdeep</dc:creator>
      <dc:date>2020-01-22T20:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: PRC DS2 ERROR: Syntax error at or near "CONTAINS"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/618476#M181792</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone please help me out...!!! There is not much relevant information I found related to FedSQL queries over forums, that's why I need some suggestions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If anyone find any information related to FedSQL queries functions, please do share here....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance....&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 20:10:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/618476#M181792</guid>
      <dc:creator>rajdeep</dc:creator>
      <dc:date>2020-01-22T20:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DS2 ERROR: Syntax error at or near "CONTAINS"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/619295#M181793</link>
      <description>&lt;P&gt;Hello Folks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if anyone having any suggestions or workarounds. I need the help here badly.. Thanks in advance....&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 20:11:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/619295#M181793</guid>
      <dc:creator>rajdeep</dc:creator>
      <dc:date>2020-01-22T20:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DS2 ERROR: Syntax error at or near "CONTAINS"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623869#M183722</link>
      <description>&lt;P&gt;The problem that DS2 is integrated with FedSQL, not PROC SQL, and FedSQL is significantly more strict about ANSI expressions - it has very few SAS extensions, and the CONTAINS operator is one of these. Specifically:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt; on strip(upcase(matsc.OCCUPATION_DESC)) &lt;FONT color="#FF0000"&gt;CONTAINS&lt;/FONT&gt; strip(upcase(SPMF.OCCUPATION))&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;or strip(upcase(matsc.OCCUPATION_DESC))&amp;nbsp;&lt;FONT color="#FF0000"&gt;CONTAINS&lt;/FONT&gt; strip(upcase(SPMF.STANDARD_PROFESSION))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Instead of the SAS-specific CONTAINS operator, use the ANSI LIKE operator. Something like this should work for you:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;thread newton/overwrite=yes;
   method run();
	   SET {Select distinct matsc.*,SPMF.Final
              from Maturity_score matsc 
              left join 
              OCCUPATION_XREF_MAP SPMF 
              on    strip(upcase(matsc.OCCUPATION_DESC)) like '%'||strip(upcase(SPMF.OCCUPATION))||'%' 
                 or strip(upcase(matsc.OCCUPATION_DESC)) like '%'||strip(upcase(SPMF.STANDARD_PROFESSION))||'%'
           }
; /* Ability to use FedSql query within DS2 */
end;
endthread;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 15:08:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623869#M183722</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2020-02-11T15:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DS2 ERROR: Syntax error at or near "CONTAINS"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623871#M183723</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A id="link_8" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13728" target="_self"&gt;SASJedi&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Thanks a lot for your reply. That worked.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Have a great day ahead.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 15:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623871#M183723</guid>
      <dc:creator>rajdeep</dc:creator>
      <dc:date>2020-02-11T15:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DS2 ERROR: Syntax error at or near "CONTAINS"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623872#M183724</link>
      <description>&lt;P&gt;Woot! We WIN &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Have a great day&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mark&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 15:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623872#M183724</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2020-02-11T15:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DS2 ERROR: Syntax error at or near "CONTAINS"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623880#M183725</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;SPAN class=""&gt;&lt;A id="link_38" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13728" target="_self"&gt;SASJedi&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Thanks a lot for your response. I have also another thread in the Community regarding the use of INPUTN function in Fedsql query, can you please help me out how to use the same.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;The below is the scenario and it's log.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ds2; /*Score column mapping based on Postal code and FSA*/
	thread newton/overwrite=yes;
dcl double Level;
	  method convert(double level) returns double;
 set LIB_TS23.CIF_ACCOUNT_CURR;
 Level=inputn(CIFP_CUSTOM_DATA_81,8.);
 return Level;
 end;
		method run();
			SET {select distinct
      TRIM(LEFT(PUT(CIF_ACCOUNT_CURR.CIFP_ACCOUNT_ID5,BEST32.))) as MAST_ACCOUNT_ID
   from LIB_TS23.CIF_ACCOUNT_CURR as CIF_ACCOUNT_CURR 
inner join
      LIB_ADM.ADM_STD_DISP_USER_V as ADM_STD_DISP_USER_V
   on  ADM_STD_DISP_USER_V.APA_APP_NUM = INPUTN(CIF_ACCOUNT_CURR.CIFP_CUSTOM_DATA_81,8.)
      and CIF_ACCOUNT_CURR.CIFP_OFFICER_NBR = 'ADMACE'}; /* Ability to use FedSql query within DS2 */

				end;
	endthread;
data test/overwrite=yes;
		dcl thread newton frac1; /* Declare an Instance of the newton thread */
		method run();
			set from frac1 threads=4; /* &amp;lt;--- You Change the number of threads to control the threaded reads */
		end;
	enddata;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;ERROR: Compilation error.
ERROR: Function INPUT(VARCHAR, DOUBLE) does not exist
WARNING: No function matches the given name and argument types.
ERROR: Line 34: Unable to prepare SELECT statement for table {select distinct  
       TRIM(LEFT(PUT(CIF_ACCOUNT_CURR.CIFP_ACCOUNT_ID5,BEST32.))) as MAST_ACCOUNT_ID  from   LIB_TS23.CIF_ACCOUNT_CURR as 
       CIF_ACCOUNT_CURR  inner join  LIB_ADM.ADM_STD_DISP_USER_V as ADM_STD_DISP_USER_V  on   ADM_STD_DISP_USER_V.APA_APP_NUM 
       = INPUT(CIF_ACCOUNT_CURR.CIFP_CUSTOM_DATA_81,8.)  and CIF_ACCOUNT_CURR.CIFP_OFFICER_NBR = 'ADMACE'} (rc=0x80fff802U).
NOTE: PROC DS2 has set option NOEXEC and will continue to prepare statements.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;In the above code it's perfectly converting the&amp;nbsp;&lt;CODE class="  language-sas"&gt;&lt;STRONG&gt;CIFP_CUSTOM_DATA_81&lt;/STRONG&gt; column into Numeric variable, but in Fedsql I am not getting how to get rid of it. Infact I tried to use the Level variable inside Fedsql, but it says Level column not found. &lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;In the select you can see there is a PUT statement and TRIM which is working fine, but the where clause INPUTN function throwing the error.&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;You can replicate and try.&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 15:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623880#M183725</guid>
      <dc:creator>rajdeep</dc:creator>
      <dc:date>2020-02-11T15:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DS2 ERROR: Syntax error at or near "CONTAINS"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623912#M183729</link>
      <description>&lt;P&gt;When troubleshooting FedSQL embedded in DS2, it is often h&lt;FONT face="arial,helvetica,sans-serif"&gt;elpful to test your FedSQL query using PROC FedSQL first.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;It appear&lt;/FONT&gt;s that you did no supply single quotes surrounding the informat name, as is required for the INPUTN function. See the &lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;A href="https://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=fedsqlref&amp;amp;docsetTarget=n0l4p5obkjy2ygn1o7h5a6p602zm.htm&amp;amp;locale=en#n0vdp3pu1gp3f0n1rpwqrsemfn9v" target="_self"&gt;example in the for the FedSQL INPUTN &lt;/A&gt;&lt;A href="https://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=fedsqlref&amp;amp;docsetTarget=n0l4p5obkjy2ygn1o7h5a6p602zm.htm&amp;amp;locale=en#n0vdp3pu1gp3f0n1rpwqrsemfn9v" target="_self"&gt;function&lt;/A&gt;&lt;A href="https://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=fedsqlref&amp;amp;docsetTarget=n0l4p5obkjy2ygn1o7h5a6p602zm.htm&amp;amp;locale=en#n0vdp3pu1gp3f0n1rpwqrsemfn9v" target="_self"&gt;&amp;nbsp;documentation&lt;/A&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;All the best,&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Mark&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 17:26:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-DS2-ERROR-Syntax-error-at-or-near-quot-CONTAINS-quot/m-p/623912#M183729</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2020-02-11T17:26:08Z</dc:date>
    </item>
  </channel>
</rss>

