<?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 rows with condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443609#M110995</link>
    <description>&lt;P&gt;Many Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 08 Mar 2018 03:38:23 GMT</pubDate>
    <dc:creator>strqimr</dc:creator>
    <dc:date>2018-03-08T03:38:23Z</dc:date>
    <item>
      <title>Deleting rows with condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443149#M110842</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;I am working on a dataset (have) with each id has multiple rows. I wanna delete the ids for which at least one value of variable diffdate is less than 60. I am struggling with the proper condition. The following are the sample "have" and "want" datasets. Thanks in advanced.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.JPG" style="width: 179px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19020i25641EA5A5B3989D/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.JPG" alt="1.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.JPG" style="width: 137px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19021i0B5A672FB5A09187/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.JPG" alt="2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 01:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443149#M110842</guid>
      <dc:creator>strqimr</dc:creator>
      <dc:date>2018-03-07T01:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows with condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443154#M110844</link>
      <description>&lt;P&gt;Here's an easy way, with a forgiveable flaw (explained below):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;merge have (in=delete_me where=(. &amp;lt; diffdate &amp;lt; 60)) have;&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;if delete_me then delete;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Naturally, the data must be in sorted order by ID.&amp;nbsp; In addition, there can easily be a note on the log about more than one data set containing multiple observations for the BY variable.&amp;nbsp; Usually that note should trigger an investigation to see if things are working properly.&amp;nbsp; In this case, the note is expected and can be ignored.&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>Wed, 07 Mar 2018 02:21:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443154#M110844</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-07T02:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows with condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443166#M110848</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table want as
		select * from have where id not in(
			select distinct id from have where diffdate&amp;lt;60 or diffdate=.);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Mar 2018 04:13:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443166#M110848</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-03-07T04:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows with condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443167#M110849</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id $ diffdate;
datalines;
T10008 .
T10008 25
T10008 125
T10064 .
T10064 100
T10079 .
T10079 253
T10079 36
T10096 .
T10096 58
T10096 32
T10096 39
T10135  .
T10135 147
T10139 .
T10139 98
T10139 80
;

data _null_;
set have;
if _n_=1 then do;
 declare hash h(dataset: 'have', multidata: 'y',ordered:'y');
  h.definekey('id');
   h.definedata('id','diffdate');
  h.definedone();
  end;
set have(where=(. &amp;lt; diffdate &amp;lt; 60)) end=last;
if h.check()=0 then h.remove();
if last then h.output(dataset:'want');
run;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Mar 2018 04:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443167#M110849</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-07T04:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows with condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443609#M110995</link>
      <description>&lt;P&gt;Many Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 03:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-rows-with-condition/m-p/443609#M110995</guid>
      <dc:creator>strqimr</dc:creator>
      <dc:date>2018-03-08T03:38:23Z</dc:date>
    </item>
  </channel>
</rss>

