<?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: .ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a-name/m-p/869651#M343510</link>
    <description>&lt;P&gt;The data is specified incorrectly. That format is ambiguous as it could be a subtraction or date.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date constants in SAS are specified using 'DDMMMYY'd format, assuming this is a SAS date that's numeric. If date_opened is a character variable, you need to include it in quotes and due to numeric order it will still return the correct value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATE_OPENED is numeric (SAS date format)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; PROC SQL;
 CREATE TABLE VIEW AS 
 SELECT * 
 FROM have
 WHERE DATE_OPENED =&amp;gt; '10Apr2023'd ;
 QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;DATE_OPENED is character&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; PROC SQL;
 CREATE TABLE VIEW AS 
 SELECT * 
 FROM have
 WHERE DATE_OPENED =&amp;gt; '2023-04-10' ;
 QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270266"&gt;@VALLY&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;good day&lt;/P&gt;
&lt;P&gt;am running the below code , however it returns the error listed above&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt; PROC SQL;
 CREATE TABLE VIEW AS 
 SELECT * 
 FROM have
 WHERE DATE_OPENED =&amp;gt; 2023-04-10 ;
 QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Apr 2023 19:29:39 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2023-04-13T19:29:39Z</dc:date>
    <item>
      <title>.ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric cons</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a-name/m-p/869633#M343500</link>
      <description>&lt;P&gt;good day&lt;/P&gt;&lt;P&gt;am running the below code , however it returns the error listed above&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt; PROC SQL;
 CREATE TABLE VIEW AS 
 SELECT * 
 FROM have
 WHERE DATE_OPENED =&amp;gt; 2023-04-10 ;
 QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Apr 2023 17:55:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a-name/m-p/869633#M343500</guid>
      <dc:creator>VALLY</dc:creator>
      <dc:date>2023-04-13T17:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: .ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a-name/m-p/869644#M343504</link>
      <description>&lt;P&gt;You need to share the LOG to clarify what error you are getting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;476  PROC SQL;
477   CREATE TABLE VIEW AS
478   SELECT *
479   FROM have
480   WHERE DATE_OPENED =&amp;gt; 2023-04-10 ;
                         -
                         22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
              a missing value, BTRIM, INPUT, PUT, SUBSTRING, USER.

481   QUIT;
&lt;/PRE&gt;
&lt;P&gt;Looks like SQL does not like the use of = followed by &amp;gt;.&amp;nbsp; Did you mean "greater than or equal to"?&amp;nbsp; If so then you need to use &amp;gt;= or better still use the GE pneumonic instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code has other issues also.&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;It is not a good idea to name a dataset with the name VIEW.&amp;nbsp; That is just confusing.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;from the variable name I suspect that you need to have a DATE value after the GE operator. Currently you have a complex way of specifying the number 2,009 which is the date '02JUL1965'd.&amp;nbsp; Although it is possible that the variable actual has DATETIME values instead, in which case the number 2,009 is the datetime value '01JAN1960:00:33:29'dt.&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;498  data _null_;
499    x=2023-04-10 ;
500    put x= comma. x=date9. x=datetime19.;
501  run;

x=2,009 x=02JUL1965 x=01JAN1960:00:33:29
&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Apr 2023 18:37:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a-name/m-p/869644#M343504</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-04-13T18:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: .ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a-name/m-p/869645#M343505</link>
      <description>&lt;P&gt;In addition to the =&amp;gt; error mentioned above, you also have this error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;2023-04-10&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is how you do subtraction in SAS. SAS thinks you mean 2023 minus 4 minus 10. It is not a date (normally). Maybe you mean&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'04OCT2023'd&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which SAS will always recognize as the date October 4, 2023; or maybe you mean something else.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 20:40:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a-name/m-p/869645#M343505</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-04-13T20:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: .ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a-name/m-p/869651#M343510</link>
      <description>&lt;P&gt;The data is specified incorrectly. That format is ambiguous as it could be a subtraction or date.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date constants in SAS are specified using 'DDMMMYY'd format, assuming this is a SAS date that's numeric. If date_opened is a character variable, you need to include it in quotes and due to numeric order it will still return the correct value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATE_OPENED is numeric (SAS date format)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; PROC SQL;
 CREATE TABLE VIEW AS 
 SELECT * 
 FROM have
 WHERE DATE_OPENED =&amp;gt; '10Apr2023'd ;
 QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;DATE_OPENED is character&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; PROC SQL;
 CREATE TABLE VIEW AS 
 SELECT * 
 FROM have
 WHERE DATE_OPENED =&amp;gt; '2023-04-10' ;
 QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270266"&gt;@VALLY&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;good day&lt;/P&gt;
&lt;P&gt;am running the below code , however it returns the error listed above&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt; PROC SQL;
 CREATE TABLE VIEW AS 
 SELECT * 
 FROM have
 WHERE DATE_OPENED =&amp;gt; 2023-04-10 ;
 QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 19:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a-name/m-p/869651#M343510</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-04-13T19:29:39Z</dc:date>
    </item>
  </channel>
</rss>

