<?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: Removing/Deleting Observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279782#M56427</link>
    <description>&lt;P&gt;I guess you could have replaced&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;min&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;NEGHISDAYS&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;105&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;by&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;min&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;NEGHISDAYS&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; between 1 and &lt;SPAN class="token number"&gt;105&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jun 2016 18:24:47 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2016-06-23T18:24:47Z</dc:date>
    <item>
      <title>Removing/Deleting Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279772#M56424</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if someone could help me remove/delete some observations on my dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my dataset, members can have multiple observations, and the number of observations vary. &amp;nbsp;I have this variable called "NEGHISDAYS", and it ranges between 1 to 365. I want to delete the member and all their observations from my dataset if any of their observations has a "NEGHISDAYS" between 1 &amp;amp; 105. The code I have right now only deletes the specific observations that falls between 1 &amp;amp; 105 but the other observations remain, but that is not what I want. I want the member and all their records removed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp; &amp;nbsp; NEGHISDAYS&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;25&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;107&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The example has one member with four observations; one observation (observation 2) falls between 1&amp;amp;105. My current code removes observations 2 but keeps the other observations. However, since observation 2 falls between 1&amp;amp;105, I want the member and all their records (observations 1 -4) removed. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am using SAS 9.2.&amp;nbsp;&lt;/SPAN&gt;&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;&lt;P&gt;&amp;nbsp;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 17:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279772#M56424</guid>
      <dc:creator>TXSASneophyte</dc:creator>
      <dc:date>2016-06-23T17:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Removing/Deleting Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279778#M56425</link>
      <description>&lt;P&gt;Use this query:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;

create table toBeDeleted as
select ID 
from myData
group by ID
having min(NEGHISDAYS) &amp;lt;= 105;
 
delete from myData
where ID in (select ID from toBeDeleted);

drop table toBeDeleted;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(untested)&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 17:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279778#M56425</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-23T17:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: Removing/Deleting Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279781#M56426</link>
      <description>&lt;P&gt;Your code worked! There was a minor kink at first because there are missing values, which your code deleted even though I wanted to keep them. I didn't know how to tweak the code you provided to keep the missing values if they did not violate my criteria of falling between 1 &amp;amp; 105. However, I did have another variable without any missing values that I used with your code and it worked fantastically well!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all the help!!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 18:17:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279781#M56426</guid>
      <dc:creator>TXSASneophyte</dc:creator>
      <dc:date>2016-06-23T18:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Removing/Deleting Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279782#M56427</link>
      <description>&lt;P&gt;I guess you could have replaced&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;min&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;NEGHISDAYS&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;105&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;by&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;min&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;NEGHISDAYS&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; between 1 and &lt;SPAN class="token number"&gt;105&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 18:24:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279782#M56427</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-23T18:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Removing/Deleting Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279826#M56434</link>
      <description>&lt;P&gt;That worked! I'm still relativley new to SAS, so using "between # and #" was out of my radar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for all the help &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 19:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Deleting-Observations/m-p/279826#M56434</guid>
      <dc:creator>TXSASneophyte</dc:creator>
      <dc:date>2016-06-23T19:41:49Z</dc:date>
    </item>
  </channel>
</rss>

