<?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 Invalid Option name OR in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769092#M243985</link>
    <description>&lt;P&gt;In the following code, I'd like to know about the error which I made. is it duo to missing or incorrect parenthesis?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm getting the Invalid Option name OR error when I execute this code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc Summary data=&amp;amp;_INPUT1(where=(KEY IN ("&amp;amp;clm_paid.","&amp;amp;alae_paid.") AND 
    (input(CALENDAR_MONTH,anydtdte7.) lt REPORTING_DT))
    OR 
    (KEY IN ("&amp;amp;clmcase.","&amp;amp;ala_case.") AND 
    intnx('month' ,input(CALENDAR_MONTH,anydtdte7.),0,'e') eq intnx('qtr',&amp;amp;REPORTINGDATE.,-1,'e')))

    class BRANCH SEGMENT BUSINESS;
    VAR CONTRACT_PERIOD_OF_ACCIDENT;
    output OUT=list;
run;&lt;/PRE&gt;</description>
    <pubDate>Wed, 22 Sep 2021 11:03:55 GMT</pubDate>
    <dc:creator>David_Billa</dc:creator>
    <dc:date>2021-09-22T11:03:55Z</dc:date>
    <item>
      <title>Invalid Option name OR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769092#M243985</link>
      <description>&lt;P&gt;In the following code, I'd like to know about the error which I made. is it duo to missing or incorrect parenthesis?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm getting the Invalid Option name OR error when I execute this code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc Summary data=&amp;amp;_INPUT1(where=(KEY IN ("&amp;amp;clm_paid.","&amp;amp;alae_paid.") AND 
    (input(CALENDAR_MONTH,anydtdte7.) lt REPORTING_DT))
    OR 
    (KEY IN ("&amp;amp;clmcase.","&amp;amp;ala_case.") AND 
    intnx('month' ,input(CALENDAR_MONTH,anydtdte7.),0,'e') eq intnx('qtr',&amp;amp;REPORTINGDATE.,-1,'e')))

    class BRANCH SEGMENT BUSINESS;
    VAR CONTRACT_PERIOD_OF_ACCIDENT;
    output OUT=list;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Sep 2021 11:03:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769092#M243985</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2021-09-22T11:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Option name OR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769100#M243987</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The syntax is (where=( expression ));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So make sure you have balanced parantheses &lt;STRONG&gt;in the expresson&lt;/STRONG&gt;, so the number of right parantheses is equal to the&amp;nbsp;number of right parantheses, so you don't by accident have an extra paranthesis that ends the where=( .&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 11:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769100#M243987</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2021-09-22T11:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Option name OR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769111#M243988</link>
      <description>&lt;P&gt;In most (all?) SAS editors, you can check for imbalanced parentheses. For example, in Base SAS Enhanced Editor, place your cursor to the left of the last parenthesis and then press Ctrl-[ and the cursor should move to the corresponding parenthesis. When I do this on the text&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;(where=(KEY IN ("&amp;amp;clm_paid.","&amp;amp;alae_paid.") AND 
    (input(CALENDAR_MONTH,anydtdte7.) lt REPORTING_DT))
    OR 
    (KEY IN ("&amp;amp;clmcase.","&amp;amp;ala_case.") AND 
    intnx('month' ,input(CALENDAR_MONTH,anydtdte7.),0,'e') eq intnx('qtr',&amp;amp;REPORTINGDATE.,-1,'e')))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I find no imbalance from start to end. That doesn't mean there aren't imbalances within, so you can then (for example) place the cursor to the left of the 2nd right parenthesis after &lt;FONT face="courier new,courier"&gt;lt reporting_dt&lt;/FONT&gt;, and press Ctrl-[ and the cursor will move to the corresponding left parenthesis. Now you have identified the problem, the WHERE= ( ) has ended after &lt;FONT face="courier new,courier"&gt;lt reporting_dt))&lt;/FONT&gt;. So you can't use OR after that, and you will need to modify the parentheses to get this to work.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;From now on, when you get an error in the log, &lt;STRONG&gt;please please please&amp;nbsp;please please please&amp;nbsp;please please please&lt;/STRONG&gt; show us the entire log for this step, preserving the formatting by copying the log as text clicking on the &amp;lt;/&amp;gt; icon and pasting the log into the window that appears.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 12:12:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769111#M243988</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-22T12:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Option name OR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769702#M244078</link>
      <description>&lt;P&gt;Both by inspecting the code and from the error message, you have a balanced set of parentheses here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where=(KEY IN ("&amp;amp;clm_paid.","&amp;amp;alae_paid.") AND 
    (input(CALENDAR_MONTH,anydtdte7.) lt REPORTING_DT))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This means the WHERE clause ends here, and OR is not part of the WHERE clause.&amp;nbsp; Thus the message about the invalid OR option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While you know the logic that you want the best, it seems the second ")" after REPORTING_DT should be moved to the end of the WHERE clause, giving four closed parentheses instead of three.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 20:13:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769702#M244078</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-09-22T20:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Option name OR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769705#M244080</link>
      <description>&lt;P&gt;As long as you write badly formatted "spaghetti" code with no consistent indentation, you deprive yourself of a visual identification of functional blocks.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc Summary
  data=&amp;amp;_INPUT1 (
    where=(
      KEY IN ("&amp;amp;clm_paid.","&amp;amp;alae_paid.") AND (
        input(CALENDAR_MONTH,anydtdte7.) lt REPORTING_DT
      )
    )
    OR (
      KEY IN ("&amp;amp;clmcase.","&amp;amp;ala_case.") AND 
      intnx('month' ,input(CALENDAR_MONTH,anydtdte7.),0,'e') eq intnx('qtr',&amp;amp;REPORTINGDATE.,-1,'e')
    )
  )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can now easily see that the keyword OR appears on the same hierarchical level as the WHERE= dataset option, and is therefore interpreted as another (invalid) dataset option.&lt;/P&gt;
&lt;P&gt;You also miss the semicolon that must terminate the PROC SUMMARY statement.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 20:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769705#M244080</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-22T20:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Option name OR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769762#M244106</link>
      <description>&lt;P&gt;100% with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;here.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Code should be pretty.&lt;/STRONG&gt; You spend seconds to align and format it, and save minutes or hours to understand, debug, and maintain it.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 00:21:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Option-name-OR/m-p/769762#M244106</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-09-23T00:21:59Z</dc:date>
    </item>
  </channel>
</rss>

