<?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 180-322: Statement is not valid or it is used out of proper order in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/735033#M228963</link>
    <description>&lt;P&gt;Please copy the entire data step or procedure when asking questions about notes, errors or warnings. Sometimes the "cause" is something before the place indicates an error such as a missing semicolon, matching quote or parentheses.&lt;/P&gt;
&lt;P&gt;Copy the entire text from the LOG, open a text box on the forum using the &amp;lt;/&amp;gt; icon and paste the text.&lt;/P&gt;
&lt;P&gt;Many of the errors like 180-322 often place diagnostic characters in the text and pasting the result into the main message window gets the text reformatted so the diagnostics are in the wrong place.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your use of &amp;amp;W is placing it in the position of a variable assigning a value. By default variable names cannot contain quote marks.&lt;/P&gt;
&lt;P&gt;If &amp;amp;T and &amp;amp;C are also supposed to be variables do not place the value in quotes.&lt;/P&gt;
&lt;P&gt;You have created lines of code like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Data  Grocery2;
   set  Grocery1;
  if  "Temp_status"= "missing"  or "cough" = "" then  "Work_status" = "DayOff" ;
  else if  "Temp_status" = "normal"  and "cough" = "N" then   "Work_status" = "Worked" ;
  else   "Work_status" = "Sick" ;
run ;&lt;/PRE&gt;
&lt;P&gt;Since this code compares the literal text value of "Temp_status" to "missing" or "normal" it is never true. Also "cough" is never true compared to "" or "N".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 18 Apr 2021 06:12:32 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-04-18T06:12:32Z</dc:date>
    <item>
      <title>ERROR 180-322: Statement is not valid or it is used out of proper order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/734997#M228956</link>
      <description>&lt;P&gt;&lt;SPAN&gt;hey, I'm confused what's the problem with these codes.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Log shows&amp;nbsp;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there anything wrong?&lt;span class="lia-unicode-emoji" title=":anxious_face_with_sweat:"&gt;😰&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%let&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; T = "Temp_status";&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%let&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; W = "Work_Status";&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%let&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; C = "cough";&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Data&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; Grocery2;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; Grocery1;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; &amp;amp;T = &lt;SPAN&gt;"missing"&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; or &amp;amp;C = &lt;SPAN&gt;"" &lt;/SPAN&gt;&lt;SPAN&gt;then&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; &amp;amp;W = &lt;SPAN&gt;"DayOff"&lt;/SPAN&gt; ;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;else if&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; &amp;amp;T = &lt;SPAN&gt;"normal"&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; and &amp;amp;C = &lt;SPAN&gt;"N" &lt;/SPAN&gt;&lt;SPAN&gt;then&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; &amp;amp;W = &lt;SPAN&gt;"Worked"&lt;/SPAN&gt; ;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;else&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; &amp;amp;W = &lt;SPAN&gt;"Sick"&lt;/SPAN&gt; ;&lt;/P&gt;&lt;P&gt;run&lt;SPAN&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc freq &lt;/SPAN&gt;&lt;SPAN&gt;data&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt; = grocery2;&lt;/P&gt;&lt;P&gt;table&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;T*&amp;amp;C*&amp;amp;W/&lt;/SPAN&gt;list missing&lt;SPAN&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;run&lt;SPAN&gt; ;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 01:37:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/734997#M228956</guid>
      <dc:creator>Jin19980327</dc:creator>
      <dc:date>2021-04-18T01:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 180-322: Statement is not valid or it is used out of proper order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/735033#M228963</link>
      <description>&lt;P&gt;Please copy the entire data step or procedure when asking questions about notes, errors or warnings. Sometimes the "cause" is something before the place indicates an error such as a missing semicolon, matching quote or parentheses.&lt;/P&gt;
&lt;P&gt;Copy the entire text from the LOG, open a text box on the forum using the &amp;lt;/&amp;gt; icon and paste the text.&lt;/P&gt;
&lt;P&gt;Many of the errors like 180-322 often place diagnostic characters in the text and pasting the result into the main message window gets the text reformatted so the diagnostics are in the wrong place.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your use of &amp;amp;W is placing it in the position of a variable assigning a value. By default variable names cannot contain quote marks.&lt;/P&gt;
&lt;P&gt;If &amp;amp;T and &amp;amp;C are also supposed to be variables do not place the value in quotes.&lt;/P&gt;
&lt;P&gt;You have created lines of code like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Data  Grocery2;
   set  Grocery1;
  if  "Temp_status"= "missing"  or "cough" = "" then  "Work_status" = "DayOff" ;
  else if  "Temp_status" = "normal"  and "cough" = "N" then   "Work_status" = "Worked" ;
  else   "Work_status" = "Sick" ;
run ;&lt;/PRE&gt;
&lt;P&gt;Since this code compares the literal text value of "Temp_status" to "missing" or "normal" it is never true. Also "cough" is never true compared to "" or "N".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 06:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/735033#M228963</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-18T06:12:32Z</dc:date>
    </item>
  </channel>
</rss>

