<?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 Syntax error in WHERE statement - proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-WHERE-statement-proc-sql/m-p/829546#M327757</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I would like to merge two data set and also create a new variable by using proc sql. This is my code but am getting the following syntax error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class=""&gt;proc sql;&lt;/DIV&gt;
&lt;DIV class=""&gt;create table final_table_0607 as&lt;/DIV&gt;
&lt;DIV class=""&gt;select * from case_07 as x left join mth_0607 as y&lt;/DIV&gt;
&lt;DIV class=""&gt;on x.bene_id = y.bene_id&lt;/DIV&gt;
&lt;DIV class=""&gt;where month_fu-(mondx1+12) as month_std;&lt;/DIV&gt;
&lt;DIV class=""&gt;__&lt;/DIV&gt;
&lt;DIV class=""&gt;22&lt;/DIV&gt;
&lt;DIV class=""&gt;76&lt;/DIV&gt;
&lt;DIV class=""&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN,&lt;/DIV&gt;
&lt;DIV class=""&gt;CONTAINS, EQ, EQT, EXCEPT, GE, GET, GROUP, GT, GTT, HAVING, IN, INTERSECT, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT,&lt;/DIV&gt;
&lt;DIV class=""&gt;NOTIN, OR, ORDER, OUTER, UNION, ^, ^=, |, ||, ~, ~=.&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;</description>
    <pubDate>Mon, 22 Aug 2022 07:00:32 GMT</pubDate>
    <dc:creator>CathyVI</dc:creator>
    <dc:date>2022-08-22T07:00:32Z</dc:date>
    <item>
      <title>Syntax error in WHERE statement - proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-WHERE-statement-proc-sql/m-p/829546#M327757</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I would like to merge two data set and also create a new variable by using proc sql. This is my code but am getting the following syntax error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class=""&gt;proc sql;&lt;/DIV&gt;
&lt;DIV class=""&gt;create table final_table_0607 as&lt;/DIV&gt;
&lt;DIV class=""&gt;select * from case_07 as x left join mth_0607 as y&lt;/DIV&gt;
&lt;DIV class=""&gt;on x.bene_id = y.bene_id&lt;/DIV&gt;
&lt;DIV class=""&gt;where month_fu-(mondx1+12) as month_std;&lt;/DIV&gt;
&lt;DIV class=""&gt;__&lt;/DIV&gt;
&lt;DIV class=""&gt;22&lt;/DIV&gt;
&lt;DIV class=""&gt;76&lt;/DIV&gt;
&lt;DIV class=""&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN,&lt;/DIV&gt;
&lt;DIV class=""&gt;CONTAINS, EQ, EQT, EXCEPT, GE, GET, GROUP, GT, GTT, HAVING, IN, INTERSECT, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT,&lt;/DIV&gt;
&lt;DIV class=""&gt;NOTIN, OR, ORDER, OUTER, UNION, ^, ^=, |, ||, ~, ~=.&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;</description>
      <pubDate>Mon, 22 Aug 2022 07:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-WHERE-statement-proc-sql/m-p/829546#M327757</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2022-08-22T07:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-WHERE-statement-proc-sql/m-p/829547#M327758</link>
      <description>&lt;P&gt;The WHERE clause needs a valid Boolean expression.&lt;/P&gt;
&lt;PRE&gt;month_fu-(mondx1+12) as month_std&lt;/PRE&gt;
&lt;P&gt;is not a Boolean expression, it rather looks like a part of the SELECT clause.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2022 10:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-WHERE-statement-proc-sql/m-p/829547#M327758</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-21T10:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-WHERE-statement-proc-sql/m-p/829553#M327764</link>
      <description>&lt;P&gt;Looks like you want to create a new variable&amp;nbsp;month_std. I would write the code as follows&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table final_table_0607 as
select *,x.month_fu-(x.mondx1+12) as month_std
 from case_07 as x left join mth_0607 as y
on x.bene_id = y.bene_id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have taken x.month_fu and x.modx1 as an example assuming it comes from the first table. You can take what ever is applicable in your case (x or y).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2022 12:27:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-WHERE-statement-proc-sql/m-p/829553#M327764</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-08-21T12:27:22Z</dc:date>
    </item>
  </channel>
</rss>

