<?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: Delete obs efficiently in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-obs-efficiently/m-p/79594#M17130</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the deletes as logical.&lt;/P&gt;&lt;P&gt;If you wish to save space, use the REUSE= data set option (only valid with COMPRESS=YES for some reason...?).&lt;/P&gt;&lt;P&gt;Be aware that the table can be fragmented and less efficient for querying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Mar 2013 12:59:44 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2013-03-18T12:59:44Z</dc:date>
    <item>
      <title>Delete obs efficiently</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-obs-efficiently/m-p/79593#M17129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I create a dataset named T with an index date,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data t(index=(date));&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 1000000;&lt;/P&gt;&lt;P&gt;&amp;nbsp; date=intnx('day','01jan2010'd,i);&lt;/P&gt;&lt;P&gt;&amp;nbsp; x=1;y=2222222;z=33333;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date yymmdd10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following two pieces of codes are to delete obs efficiently using indexes, but after submitting, I find the size of physicial file of table T don't change(perhaps called logically delete). &lt;/P&gt;&lt;P&gt;The reason why I use the following is that they do not create a new copy of the data set and delete indexes, save time of re-creating, but if logically delete, the table size will become bigger an bigger, and the IO time will increase rapidly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to balance?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data t;&lt;/P&gt;&lt;P&gt;&amp;nbsp; modify t;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if date&amp;lt;='01feb3050'd then remove t;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; delete from t where date&amp;lt;='01feb3050'd;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 12:40:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-obs-efficiently/m-p/79593#M17129</guid>
      <dc:creator>qkaiwei</dc:creator>
      <dc:date>2013-03-18T12:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Delete obs efficiently</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-obs-efficiently/m-p/79594#M17130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the deletes as logical.&lt;/P&gt;&lt;P&gt;If you wish to save space, use the REUSE= data set option (only valid with COMPRESS=YES for some reason...?).&lt;/P&gt;&lt;P&gt;Be aware that the table can be fragmented and less efficient for querying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 12:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-obs-efficiently/m-p/79594#M17130</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-03-18T12:59:44Z</dc:date>
    </item>
  </channel>
</rss>

