<?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: Deleting groups of observations. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Deleting-groups-of-observations/m-p/387917#M65891</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="log.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14475i356D59B81FC840D2/image-size/large?v=v2&amp;amp;px=999" role="button" title="log.jpg" alt="log.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;this is the log that I got.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2017 18:53:19 GMT</pubDate>
    <dc:creator>andrewfau</dc:creator>
    <dc:date>2017-08-14T18:53:19Z</dc:date>
    <item>
      <title>Deleting groups of observations.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Deleting-groups-of-observations/m-p/387906#M65889</link>
      <description>&lt;P&gt;I have a data set with a variable that specifies a use code from 000-099. I only want to keep observations that have the codes 000, 001, 002, 004, or 005. Everything I am reading is telling me I can use a statement like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if dor_uc = ('000' '001' '002' '004' '005');&lt;/P&gt;&lt;P&gt;else delete;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My log is telling me that is an incomplete if-then statement, which I get because there is no 'then' statement following the condition. In examples I am finding, though, that statement keeps the observations with the specified criteria without a 'then' statement following the condition.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a better if-then statement to write to only include observations that fit multiple criteria?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dor_uc.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14472iBAF72047E79A9E4C/image-size/large?v=v2&amp;amp;px=999" role="button" title="dor_uc.jpg" alt="dor_uc.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 18:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Deleting-groups-of-observations/m-p/387906#M65889</guid>
      <dc:creator>andrewfau</dc:creator>
      <dc:date>2017-08-14T18:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting groups of observations.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Deleting-groups-of-observations/m-p/387911#M65890</link>
      <description>&lt;P&gt;Just change the equal sign into &amp;nbsp;&lt;STRONG&gt;IN&lt;/STRONG&gt; :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if dor_uc &lt;STRONG&gt;in&lt;/STRONG&gt; ('000' '001' '002' '004' '005') &lt;STRONG&gt;then&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;else&lt;/STRONG&gt; delete; &amp;nbsp; /* else need preceding then */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR:&lt;/P&gt;
&lt;P&gt;if dor_uc &lt;STRONG&gt;in&lt;/STRONG&gt; ('000' '001' '002' '004' '005'); &amp;nbsp;/* subsets only desired values */&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 18:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Deleting-groups-of-observations/m-p/387911#M65890</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-08-14T18:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting groups of observations.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Deleting-groups-of-observations/m-p/387917#M65891</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="log.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14475i356D59B81FC840D2/image-size/large?v=v2&amp;amp;px=999" role="button" title="log.jpg" alt="log.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;this is the log that I got.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 18:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Deleting-groups-of-observations/m-p/387917#M65891</guid>
      <dc:creator>andrewfau</dc:creator>
      <dc:date>2017-08-14T18:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting groups of observations.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Deleting-groups-of-observations/m-p/387931#M65892</link>
      <description>&lt;P&gt;Your IF doesn't have a THEN so you can't have an ELSE is what it's saying.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not reverse the logic for a single line of code, use NOT IN?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="delete if then.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14476i5492D7AF94629CD6/image-size/large?v=v2&amp;amp;px=999" role="button" title="delete if then.JPG" alt="delete if then.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;PS. Don't post images, post your code and log directly into the forum please. Otherwise it means we have to type out your code instead of copy/paste and fix.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 19:22:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Deleting-groups-of-observations/m-p/387931#M65892</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-14T19:22:51Z</dc:date>
    </item>
  </channel>
</rss>

