<?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 Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/435387#M68957</link>
    <description>&lt;P&gt;Wow, I feel so stupid. Thanks for the help!&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2018 19:15:21 GMT</pubDate>
    <dc:creator>feltonjm</dc:creator>
    <dc:date>2018-02-08T19:15:21Z</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-Procedures/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/435351#M68947</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not new to SAS but I am by no means an expert.&amp;nbsp; I am working with a new dataset and trying to creating some new variables using the "if-then" statement.&amp;nbsp; However, when I do this, I keep getting the same error with each step.&amp;nbsp; I can't figure out what I am doing wrong -- I haven't had this problem before using these steps.&amp;nbsp; Please help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data=work.allmdsurgeons1;&lt;BR /&gt;set=work.allmdsurgeons;&lt;BR /&gt;if residency = 0 then res_type = 0;&lt;BR /&gt;else res_type= 1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the log after I run this, under each line I get "ERROR 180-322: Statement is not valid or it is used out of proper order."&amp;nbsp; I don't know why this is happening for the data step and the set step.&amp;nbsp; If someone could help I would really appreciate it!&amp;nbsp; Thanks!&lt;/P&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 08 Feb 2018 17:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/435351#M68947</guid>
      <dc:creator>feltonjm</dc:creator>
      <dc:date>2018-02-08T17:16:01Z</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-Procedures/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/435356#M68950</link>
      <description>&lt;P&gt;Your IF/THEN statements are fine.&amp;nbsp; However, DATA and SET statements don't use an equal sign.&amp;nbsp; Change the equal sign to a blank character for those two statements.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 17:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/435356#M68950</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-08T17:26:00Z</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-Procedures/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/435387#M68957</link>
      <description>&lt;P&gt;Wow, I feel so stupid. Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 19:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/435387#M68957</guid>
      <dc:creator>feltonjm</dc:creator>
      <dc:date>2018-02-08T19:15:21Z</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-Procedures/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/435460#M68961</link>
      <description>&lt;P&gt;With errors it is usually a good idea to paste the code with error messages. To preserve the formatting of the error messages paste them into a code box opened with the {I} menu icon on in the header of the message box on the forum. Such as:&lt;/P&gt;
&lt;PRE&gt;494  data=work.allmdsurgeons1;
     ----
     180

ERROR 180-322: Statement is not valid or it is used out of proper order.

495  set=work.allmdsurgeons;
     ---
     180

ERROR 180-322: Statement is not valid or it is used out of proper order.

496  if residency = 0 then res_type = 0;
     --
     180

ERROR 180-322: Statement is not valid or it is used out of proper order.

497  else res_type= 1;
     ----
     180

ERROR 180-322: Statement is not valid or it is used out of proper order.

498  run;
&lt;/PRE&gt;
&lt;P&gt;Which will show us which specific line and where SAS detected the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the first instance is with data you might look at example code (almost anywhere) to remember the data step does not use =, or Set.&lt;/P&gt;
&lt;P&gt;The others are because the statements are only valid in a data step and SAS has not recognized the valid start of a data step.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 21:47:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/435460#M68961</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-08T21:47:26Z</dc:date>
    </item>
  </channel>
</rss>

