<?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 obs with conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/deleting-obs-with-conditions/m-p/480099#M124041</link>
    <description>&lt;P&gt;Please post a better and comprehensive sample so responders can test their codes. In your example, count of dr=0 is 4 and it is not greater than 4 for apr00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *
from have
group by permno, month;
having sum(dr=0)&amp;lt;=4;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 20 Jul 2018 23:20:13 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-07-20T23:20:13Z</dc:date>
    <item>
      <title>deleting obs with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/deleting-obs-with-conditions/m-p/480095#M124039</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have following type of data and now I want to clean data such that I my data retains only those observations of dr when frequency of 0 &amp;lt;= 4 in any given month. If frequency of dr=0 s greater than 4 I would like to delete that entire month from my data.&lt;/P&gt;&lt;P&gt;Fir example, in the following data I would want to delete the entire month of Apr-00 as count(0) is greater than 4 but would want to retain May-00 as count (0) is only 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;permno&lt;/TD&gt;&lt;TD&gt;month&lt;/TD&gt;&lt;TD&gt;dr&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Apr-00&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Apr-00&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;…&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Apr-00&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Apr-00&lt;/TD&gt;&lt;TD&gt;1.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;May-00&lt;/TD&gt;&lt;TD&gt;3.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;May-00&lt;/TD&gt;&lt;TD&gt;1.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;…&lt;/TD&gt;&lt;TD&gt;4.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;May-00&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 23:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/deleting-obs-with-conditions/m-p/480095#M124039</guid>
      <dc:creator>Amalik</dc:creator>
      <dc:date>2018-07-20T23:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: deleting obs with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/deleting-obs-with-conditions/m-p/480099#M124041</link>
      <description>&lt;P&gt;Please post a better and comprehensive sample so responders can test their codes. In your example, count of dr=0 is 4 and it is not greater than 4 for apr00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *
from have
group by permno, month;
having sum(dr=0)&amp;lt;=4;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jul 2018 23:20:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/deleting-obs-with-conditions/m-p/480099#M124041</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-20T23:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: deleting obs with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/deleting-obs-with-conditions/m-p/480102#M124042</link>
      <description>&lt;P&gt;Thanks a bunch, it works.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 23:34:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/deleting-obs-with-conditions/m-p/480102#M124042</guid>
      <dc:creator>Amalik</dc:creator>
      <dc:date>2018-07-20T23:34:45Z</dc:date>
    </item>
  </channel>
</rss>

