<?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: Syntax error with parenthesis in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-with-parenthesis/m-p/716779#M221592</link>
    <description>&lt;P&gt;Writing unstructured spaghetti crap like that will always get you in trouble.&lt;/P&gt;
&lt;P&gt;I use the expletive on purpose here. If I saw such a line in production code, they would hear my yelling (while dressing down the **** who spit it out) in the CEO's office. Who works about half a mile (as the crow flies) from me.&lt;/P&gt;
&lt;P&gt;Just &lt;EM&gt;slightly&lt;/EM&gt; exaggerating.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See if this works for you:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;else if
  (
    index(lowcase(filename),'_copied.csv') or
    index(lowcase(filename),'_copied.xlsx')
  )  and
  "&amp;amp;function_compont" EQ 'NL' and 
  scan(lowcase(filename),5,'_') in ('5601','6010','6020')
then do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course, I had to make guesses about your logic.&lt;/P&gt;
&lt;P&gt;Also make use of the features of the Enhanced Editor, which highlights closing brackets when the cursor is positioned before the opening bracket, and opening brackets if the cursor is positioned after a closing bracket.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this all will only work for you if you make your code readable.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Maxim 12&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Maxim 12&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Maxim 12&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2021 10:13:14 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-02-04T10:13:14Z</dc:date>
    <item>
      <title>Syntax error with parenthesis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-with-parenthesis/m-p/716776#M221589</link>
      <description>&lt;P&gt;Appericiate if someone of you help me understand the problem with the code below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;PRE&gt;else if (index(lowcase(filename),'_copied.csv') or (index(lowcase(filename),'_copied.xlsx') )  and "&amp;amp;function_compont" EQ 'NL' and (scan(lowcase(filename),5,'_') in ('5601','6010','6020')) then do;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;else if (index(lowcase(filename),'_copied.csv') or (index(lowcase(filename),'_copied.xlsx') ) and "&amp;amp;function_compont"
108      !  EQ 'NL' and (scan(lowcase(filename),5,'_') in ('5601','6010','6020')) then do;
SYMBOLGEN:  Macro variable FUNCTION_COMPONT resolves to NL
108            else if (index(lowcase(filename),'_copied.csv') or (index(lowcase(filename),'_copied.xlsx') ) and "&amp;amp;function_compont"
108      !  EQ 'NL' and (scan(lowcase(filename),5,'_') in ('5601','6010','6020')) then do;
                                                                                      ____
                                                                                      22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, ), *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, 
              IN, LE, LT, MAX, MIN, NE, NG, NL, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=. &lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Feb 2021 09:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-with-parenthesis/m-p/716776#M221589</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2021-02-04T09:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error with parenthesis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-with-parenthesis/m-p/716778#M221591</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;The first parenthesis is not closed.&lt;BR /&gt;I think you should remove the opening parentheis after the "or" :&lt;BR /&gt;or index(lowcase(....</description>
      <pubDate>Thu, 04 Feb 2021 10:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-with-parenthesis/m-p/716778#M221591</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2021-02-04T10:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error with parenthesis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-with-parenthesis/m-p/716779#M221592</link>
      <description>&lt;P&gt;Writing unstructured spaghetti crap like that will always get you in trouble.&lt;/P&gt;
&lt;P&gt;I use the expletive on purpose here. If I saw such a line in production code, they would hear my yelling (while dressing down the **** who spit it out) in the CEO's office. Who works about half a mile (as the crow flies) from me.&lt;/P&gt;
&lt;P&gt;Just &lt;EM&gt;slightly&lt;/EM&gt; exaggerating.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See if this works for you:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;else if
  (
    index(lowcase(filename),'_copied.csv') or
    index(lowcase(filename),'_copied.xlsx')
  )  and
  "&amp;amp;function_compont" EQ 'NL' and 
  scan(lowcase(filename),5,'_') in ('5601','6010','6020')
then do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course, I had to make guesses about your logic.&lt;/P&gt;
&lt;P&gt;Also make use of the features of the Enhanced Editor, which highlights closing brackets when the cursor is positioned before the opening bracket, and opening brackets if the cursor is positioned after a closing bracket.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this all will only work for you if you make your code readable.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Maxim 12&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Maxim 12&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Maxim 12&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 10:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-with-parenthesis/m-p/716779#M221592</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-04T10:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error with parenthesis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-with-parenthesis/m-p/716782#M221595</link>
      <description>&lt;P&gt;Here is your code copied from the log:&lt;/P&gt;
&lt;PRE&gt;else if (index(lowcase(filename),'_copied.csv') or 
        (index(lowcase(filename),'_copied.xlsx') ) 
	and "&amp;amp;function_compont" EQ 'NL' and 
	    (scan(lowcase(filename),5,'_') in ('5601','6010','6020')) 
then do;
&lt;/PRE&gt;
&lt;P&gt;you miss an open parenthesis on first line - where it is closed on second line. Check is this what you meant. You don't need last pair of parenthesis.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;else if ((index(lowcase(filename),'_copied.csv') or 
        (index(lowcase(filename),'_copied.xlsx') ) 
	and "&amp;amp;function_compont" EQ 'NL' and 
	    scan(lowcase(filename),5,'_') in ('5601','6010','6020') 
then do;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Feb 2021 10:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-with-parenthesis/m-p/716782#M221595</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-04T10:23:27Z</dc:date>
    </item>
  </channel>
</rss>

