<?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: How to delete group of observation with having certain condition. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-group-of-observation-with-having-certain-condition/m-p/794926#M254928</link>
    <description>Thank you so much for you inputs. I appreciate your comments. that's really going to help me.</description>
    <pubDate>Tue, 08 Feb 2022 07:19:19 GMT</pubDate>
    <dc:creator>Spintu</dc:creator>
    <dc:date>2022-02-08T07:19:19Z</dc:date>
    <item>
      <title>How to delete group of observation with having certain condition.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-group-of-observation-with-having-certain-condition/m-p/794922#M254925</link>
      <description>&lt;P&gt;Need a help combination of these group (ID,Pract_name,Hospital_name)&lt;BR /&gt;if status is Terminate and Inactive then i just want to keep only teminare records.&lt;BR /&gt;if status is Active and Inactive then i don't want to delete these records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Pract_name&lt;/TD&gt;&lt;TD&gt;Hospital_name&lt;/TD&gt;&lt;TD&gt;Status&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;Terminate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;Inactive&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;ZYX&lt;/TD&gt;&lt;TD&gt;CBA&lt;/TD&gt;&lt;TD&gt;Active&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;ZYX&lt;/TD&gt;&lt;TD&gt;CBA&lt;/TD&gt;&lt;TD&gt;Inactive&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;103&lt;/TD&gt;&lt;TD&gt;ASD&lt;/TD&gt;&lt;TD&gt;QWE&lt;/TD&gt;&lt;TD&gt;Inactive&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;103&lt;/TD&gt;&lt;TD&gt;ASD&lt;/TD&gt;&lt;TD&gt;QWE&lt;/TD&gt;&lt;TD&gt;Terminate&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 08 Feb 2022 06:43:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-group-of-observation-with-having-certain-condition/m-p/794922#M254925</guid>
      <dc:creator>Spintu</dc:creator>
      <dc:date>2022-02-08T06:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete group of observation with having certain condition.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-group-of-observation-with-having-certain-condition/m-p/794924#M254927</link>
      <description>&lt;P&gt;It's normally appreciated if you post at least your sample data already via a working data have step as done below. Even better is if you post also some of your not yet working code showing what you tried.&lt;/P&gt;
&lt;P&gt;The 2nd bit - code you tried - helps us understand your level of SAS coding expertise which in return allows us to better provide a solution to you that fits your current skill level.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below one way to go.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover dsd dlm=',';
  input (ID Pract_name Hospital_name) ($) Status $10.;
  datalines;
101,XYZ,ABC,Terminate
101,XYZ,ABC,Inactive
102,ZYX,CBA,Active
102,ZYX,CBA,Inactive
103,ASD,QWE,Inactive
103,ASD,QWE,Terminate
;

data want_1;
  if _n_=1 then
    do;
      dcl hash h1(dataset:'have(where=(status="Terminate"))');
        h1.defineKey('id');
        h1.defineDone();
    end;

  set have;

  if h1.check()=0 and Status ne "Terminate" then
    delete;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Feb 2022 06:59:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-group-of-observation-with-having-certain-condition/m-p/794924#M254927</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-02-08T06:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete group of observation with having certain condition.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-group-of-observation-with-having-certain-condition/m-p/794926#M254928</link>
      <description>Thank you so much for you inputs. I appreciate your comments. that's really going to help me.</description>
      <pubDate>Tue, 08 Feb 2022 07:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-group-of-observation-with-having-certain-condition/m-p/794926#M254928</guid>
      <dc:creator>Spintu</dc:creator>
      <dc:date>2022-02-08T07:19:19Z</dc:date>
    </item>
  </channel>
</rss>

