<?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: What's wrong with my syntax? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847410#M335029</link>
    <description>&lt;P&gt;I would use a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _final_;
set have (keep=fruit vegetable);
flag_ = (fruit ne vegetable);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Dec 2022 06:51:38 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-12-02T06:51:38Z</dc:date>
    <item>
      <title>What's wrong with my syntax?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847388#M335026</link>
      <description>&lt;P&gt;I have the following code with me:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;&lt;BR /&gt;&lt;BR /&gt;create Table _final_ as&lt;BR /&gt;&lt;BR /&gt;select final_slot, calc_client_slot, CASE&lt;BR /&gt;&lt;BR /&gt;when final_slot = calc_client_slot then 0&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;else 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;end as flag_&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;from app_port;&lt;BR /&gt;&lt;BR /&gt;quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but when I run it, it shows error. Here is the log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;675  proc sql;
676  create Table _final_ as
677  select final_slot, calc_client_slot, CASE
678                                       when final_slot = calc_client_slot then 0&amp;nbsp;
                                                                                   --
                                                                                   22
                                                                                   76
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, CONTAINS, EQ, 
              EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.  

ERROR 76-322: Syntax error, statement will be ignored.

679                                       else 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
680                                       end as flag_&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
681        from app_port;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
682  quit;
NOTE: The SAS System stopped processing this step because of errors.&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Help would be appreciated. Thank you.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 08:48:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847388#M335026</guid>
      <dc:creator>SASuser4321</dc:creator>
      <dc:date>2022-12-02T08:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with my syntax?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847404#M335027</link>
      <description>&lt;P&gt;Is "vegetable" a variable?&lt;/P&gt;
&lt;P&gt;Have you tried removing the parenthesis around "case"?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 06:40:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847404#M335027</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-12-02T06:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with my syntax?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847407#M335028</link>
      <description>&lt;P&gt;Do not post just the error message. Post the whole log of the step, so we see all the message(s) in context.&lt;/P&gt;
&lt;P&gt;Copy/paste the log text into a window opened with this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 06:48:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847407#M335028</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-02T06:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with my syntax?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847410#M335029</link>
      <description>&lt;P&gt;I would use a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _final_;
set have (keep=fruit vegetable);
flag_ = (fruit ne vegetable);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Dec 2022 06:51:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847410#M335029</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-02T06:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with my syntax?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847416#M335030</link>
      <description>Please post a ready to paste example including a data step creating a mock table for _final_ that demonstrates the error.&lt;BR /&gt;--fja</description>
      <pubDate>Fri, 02 Dec 2022 07:42:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847416#M335030</guid>
      <dc:creator>fja</dc:creator>
      <dc:date>2022-12-02T07:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with my syntax?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847417#M335031</link>
      <description>NO need parent character if using CASE operator:&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create Table _final_ as&lt;BR /&gt;select weight, height, CASE&lt;BR /&gt;when weight = height then 0  &lt;BR /&gt;else 1                   &lt;BR /&gt;end as flag_     &lt;BR /&gt;from sashelp.class;&lt;BR /&gt;quit;</description>
      <pubDate>Fri, 02 Dec 2022 08:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847417#M335031</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-12-02T08:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with my syntax?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847538#M335081</link>
      <description>&lt;P&gt;Well the code you posted in the question is missing a spaces between some of the words.&lt;/P&gt;
&lt;PRE&gt;17   data _null_;
18     infile example ;
19     input;
20     list;
21   run;

NOTE: The infile EXAMPLE is:
      (system-specific pathname),
      (system-specific file attributes)

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
1         proc sql;create Table _final_ asselect final_slot, calc_client_slot, CASEwhen final_slot = calc_clie
     101  nt_slot then 0 else 1                   end as flag_    from app_port;quit; 175
NOTE: 1 record was read from the infile (system-specific pathname).
      The minimum record length was 175.
      The maximum record length was 175.
&lt;/PRE&gt;
&lt;P&gt;If you just clean that mess up it seems to work without syntax errors. Of course you didn't give us any actual data to use to really test it.&lt;/P&gt;
&lt;PRE&gt;39   proc sql;
40   create Table _final_ as
41    select final_slot
42         , calc_client_slot
43         , CASE when final_slot = calc_client_slot then 0
44                else 1
45           end as flag_
46    from app_port
47   ;
ERROR: File WORK.APP_PORT.DATA does not exist.
48   quit;
&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Dec 2022 03:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-my-syntax/m-p/847538#M335081</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-03T03:54:25Z</dc:date>
    </item>
  </channel>
</rss>

