<?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: RE: delete records in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82570#M256727</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; create table want as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; select *&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; from new&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; where id not in (select id&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from new&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where score=2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Aug 2012 16:30:17 GMT</pubDate>
    <dc:creator>Amir</dc:creator>
    <dc:date>2012-08-02T16:30:17Z</dc:date>
    <item>
      <title>RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82567#M256724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone help on this?&amp;nbsp; For example, I want to delete all persons' records who have score of 2. Many thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; new;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; ID Score;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 10pt;"&gt;1 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 10pt;"&gt;1 7&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 10pt;"&gt;1 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 10pt;"&gt;2 9&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 10pt;"&gt;2 6&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 10pt;"&gt;2 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 10pt;"&gt;3 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 10pt;"&gt;3 9&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 10pt;"&gt;3 6&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;The the new table will be:&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="128"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="21" width="64"&gt;ID&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none;" width="64"&gt;Score&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="21" style="border-top: medium none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="21" style="border-top: medium none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="21" style="border-top: medium none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 16:16:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82567#M256724</guid>
      <dc:creator>user1</dc:creator>
      <dc:date>2012-08-02T16:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82568#M256725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to have a table including all the people with the score of 2, then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data score2;&lt;/P&gt;&lt;P&gt;set new;&lt;/P&gt;&lt;P&gt;where (score = 2);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to have the table as above where you want all the scores for the person with the ID of 2, then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ID2;&lt;/P&gt;&lt;P&gt;set new;&lt;/P&gt;&lt;P&gt;where (ID = 2);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 16:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82568#M256725</guid>
      <dc:creator>tish</dc:creator>
      <dc:date>2012-08-02T16:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82569#M256726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There would be many way to do it, below just a few among them:&lt;/P&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt;input ID Score;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 2&lt;/P&gt;&lt;P&gt;1 7&lt;/P&gt;&lt;P&gt;1 .&lt;/P&gt;&lt;P&gt;2 9&lt;/P&gt;&lt;P&gt;2 6&lt;/P&gt;&lt;P&gt;2 5&lt;/P&gt;&lt;P&gt;3 2&lt;/P&gt;&lt;P&gt;3 9&lt;/P&gt;&lt;P&gt;3 6&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*sql*/&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select * from new group by id having sum(score=2)=0;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*dow*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.id);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set new;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id notsorted;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if score=2 then flag=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.id);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set new;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id notsorted;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if flag ne 1 then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end; &lt;/P&gt;&lt;P&gt;&amp;nbsp; drop flag;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /*stack*/&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;retain flag;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set new (in=up) new;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.id then call missing(flag);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if score=2 then flag=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not up and flag ne 1 then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; drop flag;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 16:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82569#M256726</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-08-02T16:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82570#M256727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; create table want as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; select *&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; from new&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; where id not in (select id&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from new&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where score=2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 16:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82570#M256727</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2012-08-02T16:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82571#M256728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help, everyone!&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 16:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82571#M256728</guid>
      <dc:creator>user1</dc:creator>
      <dc:date>2012-08-02T16:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82572#M256729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if score=2 then delete;&lt;/P&gt;&lt;P&gt;would also work in a datastep.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I might not actually delete them but when I go to the next step in analysis I would remove them using a dataset option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=new (where=(score ne 2));&lt;/P&gt;&lt;P&gt;for example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 17:36:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82572#M256729</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-08-02T17:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82573#M256730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could also implement a hash table solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA NEW2(DROP=RC ) ;&lt;/P&gt;&lt;P&gt; DECLARE&amp;nbsp; HASH&amp;nbsp; AA(DATASET:' work.new(where=(score=2) ) ' ) ;&amp;nbsp; /* only the offering IDs are ready into hash object */&lt;/P&gt;&lt;P&gt; RC=AA.DEFINEKEY( 'ID' ) ;&amp;nbsp;&amp;nbsp; RC=AA.DEFINEDONE() ;&lt;/P&gt;&lt;P&gt; DO UNTIL(EOF1) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; SET WORK.NEW&amp;nbsp; END=EOF1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; RC=AA.FIND() ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; IF RC NE 0 THEN OUTPUT ;&amp;nbsp;&amp;nbsp; /* RC=0 indicates a match, which you don't want in this instance */&lt;/P&gt;&lt;P&gt; END ;&lt;/P&gt;&lt;P&gt; STOP ;&lt;/P&gt;&lt;P&gt;RUN ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 21:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82573#M256730</guid>
      <dc:creator>KoMartin66</dc:creator>
      <dc:date>2012-08-02T21:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82574#M256731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All the hashing posts are forcing me to learn it.&amp;nbsp; Here's a slight improvement, applicable if the data are already sorted:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do until (eof1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set work.new end=eof1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.id then rc = aa.find();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if rc ne 0 then output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Search the hash table just once per ID.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 22:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82574#M256731</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-08-02T22:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82575#M256732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess the more, the merrier. Here is an array() approach, with the assumption that data is presorted by state and each state only has less than 1000 obs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*array*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;array t(1:1000,1:2) _temporary_;&lt;/P&gt;&lt;P&gt;do _n_=1 by 1 until (last.state);&lt;/P&gt;&lt;P&gt;set new;&lt;/P&gt;&lt;P&gt;by state;&lt;/P&gt;&lt;P&gt;t(_n_, 1)=state;&lt;/P&gt;&lt;P&gt;t(_n_,2)=score;&lt;/P&gt;&lt;P&gt;if score=2 then flag=1;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;if flag ne 1 then do i=1 by 1 until (i=_n_);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; state=t(i,1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; score=t(i,2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;call missing (of t(*));&lt;/P&gt;&lt;P&gt;drop flag i&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 00:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82575#M256732</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-08-03T00:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82576#M256733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The beauty of the hash is it &lt;SPAN style="text-decoration: underline;"&gt;doesn't&lt;/SPAN&gt; require the data to be pre-sorted.&amp;nbsp; Had the original post entered the datalines in some non-sorted order, your suggestion would then have to incur a sort procedure in order to make the BY processing approach work and your overall run time increases, based on the additional I/O required by the sort.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 15:14:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82576#M256733</guid>
      <dc:creator>KoMartin66</dc:creator>
      <dc:date>2012-08-03T15:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: RE: delete records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82577#M256734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or just this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA NEW2(DROP=RC ) ;&lt;/P&gt;&lt;P&gt;if _n_=1 then&lt;/P&gt;&lt;P&gt;do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; DECLARE&amp;nbsp; HASH&amp;nbsp; AA(DATASET:' work.new(where=(score=2) ) ' ) ;&amp;nbsp; /* only the offering IDs are ready into hash object */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; RC=AA.DEFINEKEY( 'ID' ) ;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; RC=AA.DEFINEDONE() ;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;set new;&lt;/P&gt;&lt;P&gt;if aa.check();&lt;/P&gt;&lt;P&gt;RUN ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Aug 2012 02:38:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RE-delete-records/m-p/82577#M256734</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-08-05T02:38:18Z</dc:date>
    </item>
  </channel>
</rss>

