<?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 Why is my IF THEN statement not valid? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-is-my-IF-THEN-statement-not-valid/m-p/781767#M249161</link>
    <description>&lt;P&gt;My code is below. The error message is also shown. How do I fix the code so it will delete Group B.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA patients;&lt;BR /&gt;INPUT PatientID Group $ ;&lt;BR /&gt;DATALINES;&lt;BR /&gt;4165 A&lt;BR /&gt;2255 B&lt;BR /&gt;3312 C&lt;BR /&gt;5689 C&lt;BR /&gt;1287 A&lt;BR /&gt;5454 A&lt;BR /&gt;6672 C&lt;BR /&gt;8521 B&lt;BR /&gt;8936 C&lt;BR /&gt;5764 B&lt;BR /&gt;;&lt;BR /&gt;IF Group = 'B' THEN DELETE;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Nov 2021 19:35:55 GMT</pubDate>
    <dc:creator>eslb2022</dc:creator>
    <dc:date>2021-11-22T19:35:55Z</dc:date>
    <item>
      <title>Why is my IF THEN statement not valid?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-my-IF-THEN-statement-not-valid/m-p/781767#M249161</link>
      <description>&lt;P&gt;My code is below. The error message is also shown. How do I fix the code so it will delete Group B.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA patients;&lt;BR /&gt;INPUT PatientID Group $ ;&lt;BR /&gt;DATALINES;&lt;BR /&gt;4165 A&lt;BR /&gt;2255 B&lt;BR /&gt;3312 C&lt;BR /&gt;5689 C&lt;BR /&gt;1287 A&lt;BR /&gt;5454 A&lt;BR /&gt;6672 C&lt;BR /&gt;8521 B&lt;BR /&gt;8936 C&lt;BR /&gt;5764 B&lt;BR /&gt;;&lt;BR /&gt;IF Group = 'B' THEN DELETE;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 19:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-my-IF-THEN-statement-not-valid/m-p/781767#M249161</guid>
      <dc:creator>eslb2022</dc:creator>
      <dc:date>2021-11-22T19:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my IF THEN statement not valid?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-my-IF-THEN-statement-not-valid/m-p/781768#M249162</link>
      <description>&lt;P&gt;Your IF statement is in the wrong place!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA patients;
INPUT PatientID Group $ ;
IF Group = 'B' THEN DELETE;
DATALINES;
4165 A
2255 B
3312 C
5689 C
1287 A
5454 A
6672 C
8521 B
8936 C
5764 B
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 19:37:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-my-IF-THEN-statement-not-valid/m-p/781768#M249162</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-11-22T19:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my IF THEN statement not valid?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-my-IF-THEN-statement-not-valid/m-p/781772#M249163</link>
      <description>&lt;P&gt;When you have in-line data the data step ends when the data begins.&lt;/P&gt;
&lt;P&gt;So you have put your IF statement in between the data step and the next step.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is why I would suggest that you get in the habit of NOT adding a RUN: statement after the in-line data lines.&amp;nbsp; It just confuses novice SAS programmers into thinking it is part of the data step.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA patients;
  INPUT PatientID Group $ ;
  IF Group = 'B' THEN DELETE;
DATALINES;
4165 A
2255 B
3312 C
5689 C
1287 A
5454 A
6672 C
8521 B
8936 C
5764 B
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 20:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-my-IF-THEN-statement-not-valid/m-p/781772#M249163</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-22T20:17:53Z</dc:date>
    </item>
  </channel>
</rss>

