<?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: &amp;quot;WHERE clause could not be parsed as written&amp;quot; error message in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627281#M185129</link>
    <description>&lt;P&gt;I think that error is covered in this note :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/54/319.html" target="_self"&gt;http://support.sas.com/kb/54/319.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Feb 2020 18:47:23 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-02-25T18:47:23Z</dc:date>
    <item>
      <title>"WHERE clause could not be parsed as written" error message</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627261#M185114</link>
      <description>&lt;P&gt;I am running EG v7.15 HF8 in Windows environment with SAS 9.4.&lt;/P&gt;&lt;P&gt;When I run this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname STULASR  sasiola SIGNER='http://sas01mdc.admin.ad.cnm.edu:80/SASLASRAuthorization' HOST='sasanalytics.admin.ad.cnm.edu' PORT=10017;

proc sql;

SELECT		SFRRSTS_TERM_CODE

FROM 		STULASR.SFRRSTS 

WHERE 		SFRRSTS_RSTS_CODE = 'RW' 
  AND 		datepart(SFRRSTS_START_DATE) &amp;lt;= input("&amp;amp;SYSDATE", date7.)
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get the error&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: The WHERE clause '((SFRRSTS_RSTS_CODE='RW') and (DATEPART(SFRRSTS_START_DATE)&amp;lt;=21970))' could not be parsed as written.&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;Jerry Black&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 18:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627261#M185114</guid>
      <dc:creator>jblack38</dc:creator>
      <dc:date>2020-02-25T18:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: "WHERE clause could not be parsed as written" error message</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627281#M185129</link>
      <description>&lt;P&gt;I think that error is covered in this note :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/54/319.html" target="_self"&gt;http://support.sas.com/kb/54/319.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 18:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627281#M185129</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-02-25T18:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: "WHERE clause could not be parsed as written" error message</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627282#M185130</link>
      <description>I should mention that I only get this error when I reference the table from the LASR library. When I reference it from our Oracle library or from the .sas7bdat file, I don't get the error.</description>
      <pubDate>Tue, 25 Feb 2020 18:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627282#M185130</guid>
      <dc:creator>jblack38</dc:creator>
      <dc:date>2020-02-25T18:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: "WHERE clause could not be parsed as written" error message</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627302#M185145</link>
      <description>&lt;P&gt;Try this instead&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;int(SFRRSTS_START_DATE/'24:00:00't) &amp;lt;= input("&amp;amp;SYSDATE", date7.)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 19:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627302#M185145</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-02-25T19:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: "WHERE clause could not be parsed as written" error message</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627320#M185158</link>
      <description>I get the same error when I change it to this code</description>
      <pubDate>Tue, 25 Feb 2020 20:36:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627320#M185158</guid>
      <dc:creator>jblack38</dc:creator>
      <dc:date>2020-02-25T20:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: "WHERE clause could not be parsed as written" error message</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627326#M185161</link>
      <description>&lt;P&gt;The only way I can get the comparison to work is to include the calculation of the datepart as one of result columns.&amp;nbsp;&amp;nbsp;In my case this doesn't give me what I want because I'm trying to get a distinct list of SFRRSTS_Term_Code's.&amp;nbsp;&amp;nbsp;But I can get what I want by encapsulating this as a subquery.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;

select 		distinct SFRRSTS_TERM_CODE
from
			(SELECT		SFRRSTS_TERM_CODE,
						datepart(SFRRSTS_START_DATE) as date_only
			FROM 		stulasr.SFRRSTS 

			WHERE 		SFRRSTS_RSTS_CODE = 'RW' 
				and	 (calculated date_only ) &amp;lt;= input("&amp;amp;SYSDATE", date7.)
			)
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I was&amp;nbsp; hoping it was just something I was doing wrong and there would be a cleaner solution.&lt;/P&gt;&lt;P&gt;Thanks for your suggestions!&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 21:01:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-WHERE-clause-could-not-be-parsed-as-written-quot-error/m-p/627326#M185161</guid>
      <dc:creator>jblack38</dc:creator>
      <dc:date>2020-02-25T21:01:13Z</dc:date>
    </item>
  </channel>
</rss>

