<?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: If then error 180-322 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591594#M169496</link>
    <description>&lt;P&gt;Your statements don't refer to a input data set they're in the middle of your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to wrap that in a data step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're also reading 4 data points, status, T1, T2 and Index but have no values for index? Any particular reason for that? I could see that causing issues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would also &lt;STRONG&gt;very strongly recommend&lt;/STRONG&gt; referencing the data set you want to print in PROC PRINT via &lt;STRONG&gt;DATA=&lt;/STRONG&gt; so it's explicit otherwise by default it prints the last data set but if you had an error in your code, that may not be the data set you wanted to see.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data cc;
input status T1 T2 &lt;FONT size="4" color="#FF0000"&gt;&lt;STRONG&gt;index&lt;/STRONG&gt;&lt;/FONT&gt;; 
cards;
   4	          0             1 .
   6              2             1 .
   .              0             0 .
;
run;

&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;data cc2;
set cc;&lt;/STRONG&gt;&lt;/FONT&gt;
if status &amp;lt;=5 then output;
index =(2 * T1) + T2;
&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;run;&lt;/FONT&gt;&lt;/STRONG&gt;

title 'Data set after import';
proc print &lt;FONT color="#993366"&gt;&lt;STRONG&gt;data=cc&lt;/STRONG&gt;&lt;/FONT&gt;;
run; 

title 'Data set after calculation';
proc print &lt;STRONG&gt;&lt;FONT color="#993366"&gt;data=cc2&lt;/FONT&gt;&lt;/STRONG&gt;;
run; &lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265801"&gt;@Amy0223&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I got 2 errors below under if and index, could anyone tell me how to correct it? I greatly appreciate your help!&lt;/P&gt;
&lt;PRE&gt;data cc;&lt;BR /&gt;input status T1 T2 index; &lt;BR /&gt;cards;&lt;BR /&gt;   4	          0             1 .&lt;BR /&gt;   6              2             1 .&lt;BR /&gt;   .              0             0 .&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;if status &amp;lt;=5 then output;&lt;BR /&gt;index =(2 * T1) + T2;&lt;BR /&gt;proc print;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasSource"&gt;if status &amp;lt;=5 then output;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;__&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;index =(2 * T1) + T2;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_____&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Sep 2019 15:53:27 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-09-25T15:53:27Z</dc:date>
    <item>
      <title>If then error 180-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591592#M169495</link>
      <description>&lt;P&gt;I got 2 errors below under if and index, could anyone tell me how to correct it? I greatly appreciate your help!&lt;/P&gt;&lt;PRE&gt;data cc;&lt;BR /&gt;input status T1 T2 index; &lt;BR /&gt;cards;&lt;BR /&gt;   4	          0             1 .&lt;BR /&gt;   6              2             1 .&lt;BR /&gt;   .              0             0 .&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;if status &amp;lt;=5 then output;&lt;BR /&gt;index =(2 * T1) + T2;&lt;BR /&gt;proc print;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;if status &amp;lt;=5 then output;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;__&lt;/DIV&gt;&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;index =(2 * T1) + T2;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_____&lt;/DIV&gt;&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 15:42:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591592#M169495</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-09-25T15:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: If then error 180-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591594#M169496</link>
      <description>&lt;P&gt;Your statements don't refer to a input data set they're in the middle of your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to wrap that in a data step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're also reading 4 data points, status, T1, T2 and Index but have no values for index? Any particular reason for that? I could see that causing issues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would also &lt;STRONG&gt;very strongly recommend&lt;/STRONG&gt; referencing the data set you want to print in PROC PRINT via &lt;STRONG&gt;DATA=&lt;/STRONG&gt; so it's explicit otherwise by default it prints the last data set but if you had an error in your code, that may not be the data set you wanted to see.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data cc;
input status T1 T2 &lt;FONT size="4" color="#FF0000"&gt;&lt;STRONG&gt;index&lt;/STRONG&gt;&lt;/FONT&gt;; 
cards;
   4	          0             1 .
   6              2             1 .
   .              0             0 .
;
run;

&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;data cc2;
set cc;&lt;/STRONG&gt;&lt;/FONT&gt;
if status &amp;lt;=5 then output;
index =(2 * T1) + T2;
&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;run;&lt;/FONT&gt;&lt;/STRONG&gt;

title 'Data set after import';
proc print &lt;FONT color="#993366"&gt;&lt;STRONG&gt;data=cc&lt;/STRONG&gt;&lt;/FONT&gt;;
run; 

title 'Data set after calculation';
proc print &lt;STRONG&gt;&lt;FONT color="#993366"&gt;data=cc2&lt;/FONT&gt;&lt;/STRONG&gt;;
run; &lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265801"&gt;@Amy0223&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I got 2 errors below under if and index, could anyone tell me how to correct it? I greatly appreciate your help!&lt;/P&gt;
&lt;PRE&gt;data cc;&lt;BR /&gt;input status T1 T2 index; &lt;BR /&gt;cards;&lt;BR /&gt;   4	          0             1 .&lt;BR /&gt;   6              2             1 .&lt;BR /&gt;   .              0             0 .&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;if status &amp;lt;=5 then output;&lt;BR /&gt;index =(2 * T1) + T2;&lt;BR /&gt;proc print;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasSource"&gt;if status &amp;lt;=5 then output;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;__&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;index =(2 * T1) + T2;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_____&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 15:53:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591594#M169496</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-25T15:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: If then error 180-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591595#M169497</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265801"&gt;@Amy0223&lt;/a&gt;&amp;nbsp; Are you after this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cc;
input status T1 T2 ; 

index =(2 * T1) + T2;

if status &amp;lt;=5 and not missing(status) then output;
cards;
   4	          0             1 .
   6              2             1 .
   .              0             0 .
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Sep 2019 15:48:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591595#M169497</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-25T15:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: If then error 180-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591601#M169500</link>
      <description>&lt;P&gt;Thank you so much! I understand it now.&amp;nbsp; I greatly appreciate your quick response!&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 16:05:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591601#M169500</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-09-25T16:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: If then error 180-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591603#M169502</link>
      <description>&lt;P&gt;Thank you very much for your help! I got errors because I didn't set cc&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;data cc2;
set cc;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 16:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591603#M169502</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-09-25T16:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: If then error 180-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591606#M169504</link>
      <description>&lt;P&gt;A data step with cards or datelines ends right there, what follows is data, and when that ends, you have the step boundary. You also don't need a run; to create the step boundary.&lt;/P&gt;
&lt;P&gt;You can incorporate your other statements into the data step, though:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cc;
input status T1 T2;
if status &amp;lt;= 5;
index = (2 * T1) + T2;
cards;
   4	          0             1
   6              2             1
   .              0             0
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Mind that I omitted the output statement, because it would have prevented the calculation from having an effect on the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 16:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591606#M169504</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-25T16:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: If then error 180-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591610#M169506</link>
      <description>Thank you very much for taking the time to answer my question. It's really helpful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 25 Sep 2019 16:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-error-180-322/m-p/591610#M169506</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-09-25T16:29:28Z</dc:date>
    </item>
  </channel>
</rss>

