<?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 data rows without affecting indexes or keys in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397796#M96161</link>
    <description>You need to show us the log from this operation including the libname statement.</description>
    <pubDate>Thu, 21 Sep 2017 15:19:18 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2017-09-21T15:19:18Z</dc:date>
    <item>
      <title>Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397494#M96069</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a newbie with SAS archiving of data. I would like to know how can I delete older datas w/o affecting indexes and account/party keys.&lt;/P&gt;&lt;P&gt;I need to delete data w/ year 2010 and below. The account/party resets to 0,1,2,3,4 so on so forth where in it should start to different count. I hope I make sense.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;kenjots&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 15:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397494#M96069</guid>
      <dc:creator>brutal3239</dc:creator>
      <dc:date>2017-09-20T15:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397500#M96071</link>
      <description>Not really. &lt;BR /&gt;Try to exemplify with a sample.</description>
      <pubDate>Wed, 20 Sep 2017 15:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397500#M96071</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-09-20T15:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397661#M96126</link>
      <description>Let say I have this kind of data. Take note that account party is auto increment.&lt;BR /&gt;&lt;BR /&gt;ACCOUNT_PARTY NAME DATE&lt;BR /&gt;1 ALPHA 2017&lt;BR /&gt;2 BETA 2016&lt;BR /&gt;3 CHARLIE 2018&lt;BR /&gt;4 DELTA 2015&lt;BR /&gt;5 FOXTROT 2016&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I would like to select all data where year &amp;gt; 2016. So that output should be like this&lt;BR /&gt;&lt;BR /&gt;ACCOUNT_PARTY NAME DATE&lt;BR /&gt;1 ALPHA 2017&lt;BR /&gt;3 CHARLIE 2018&lt;BR /&gt;&lt;BR /&gt;However, upon opening the temporary dataset in work library, the output is like this.&lt;BR /&gt;&lt;BR /&gt;ACCOUNT_PARTY NAME DATE&lt;BR /&gt;1 ALPHA 2017&lt;BR /&gt;2 CHARLIE 2018&lt;BR /&gt;&lt;BR /&gt;The account party resets to normal count.</description>
      <pubDate>Thu, 21 Sep 2017 01:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397661#M96126</guid>
      <dc:creator>brutal3239</dc:creator>
      <dc:date>2017-09-21T01:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397694#M96136</link>
      <description>&lt;P&gt;There is no&amp;nbsp;&lt;SPAN&gt;auto increment field in SAS.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So you are probably using Oracle data or similar.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you don't want to value to change, you have to turn off in auto-increment. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can't ask for the field to be populated automatically &lt;STRONG&gt;and&lt;/STRONG&gt; for the field not to change.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 06:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397694#M96136</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-09-21T06:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397729#M96150</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/109676"&gt;@brutal3239&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;That's certainly not a SAS table unless you're telling us only a very scalled down and distorted part of the story. If you're interfacing with a database then what's the database?&lt;/P&gt;
&lt;P&gt;If it's Oracle then there would be options&amp;nbsp;to implement an autoincrement field which generates a&amp;nbsp;key for you which doesn't change (i.e. using a sequencer object in an insert trigger; the newer versions of Oracle also have a specific new field type for such a requirement).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...but as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;already hints: That's something you need to solve on the database side.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 10:49:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397729#M96150</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-21T10:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397786#M96159</link>
      <description>&lt;P&gt;As mentioned, it is a sas dataset.&amp;nbsp; I would like to know how to delete rows w/o affecting the indexes?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 14:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397786#M96159</guid>
      <dc:creator>brutal3239</dc:creator>
      <dc:date>2017-09-21T14:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397796#M96161</link>
      <description>You need to show us the log from this operation including the libname statement.</description>
      <pubDate>Thu, 21 Sep 2017 15:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397796#M96161</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-09-21T15:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397808#M96162</link>
      <description>&lt;P&gt;Looks like this but again, the party_key count will reset to 0,1,2,3 so on so forth. I want to retain the party_key index.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table tmp as&lt;BR /&gt;select * from core.transaction_table where&lt;BR /&gt;month_key &amp;lt;= 201201&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 15:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397808#M96162</guid>
      <dc:creator>brutal3239</dc:creator>
      <dc:date>2017-09-21T15:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397839#M96175</link>
      <description>&lt;P&gt;What are you talking about? The code you posted creates a new dataset named "tmp", there is no code creating an index.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The concept "index" is described &lt;A href="https://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000440261.htm" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 17:24:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397839#M96175</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2017-09-21T17:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397911#M96205</link>
      <description>&lt;P&gt;Can you explain what you are talking about? &amp;nbsp;SAS will not change any data values if you delete observations.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  length ACCOUNT_PARTY 8 NAME $20 DATE 8;
  input ACCOUNT_PARTY NAME DATE ;
cards;
1 ALPHA 2017
2 BETA 2016
3 CHARLIE 2018
4 DELTA 2015
5 FOXTROT 2016
;

proc sort data=have ;
  by date ;
run;
proc print data=have ;
run;
proc print data=have ;
  where date &amp;gt; 2016 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 283px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15346iCF4EA9A522C4BC82/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 19:48:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/397911#M96205</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-21T19:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/398705#M96474</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would it be okay if I message/email you our sample data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;brutal3239&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 03:11:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/398705#M96474</guid>
      <dc:creator>brutal3239</dc:creator>
      <dc:date>2017-09-26T03:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/398756#M96489</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/109676"&gt;@brutal3239&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If there is nothing confidential in your sample data then you can also attach them here.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 09:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/398756#M96489</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-26T09:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/399434#M96742</link>
      <description>&lt;P&gt;After deleting rows, how am i going to compress the dataset? It is still 17GB albeit more than 500k rows were deleted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried this,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table tmp&amp;nbsp;&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;COMPRESS=YES&lt;/P&gt;&lt;P&gt;) as&lt;/P&gt;&lt;P&gt;***then delete rows****&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked. However, it is in work library. I want to do it directly to the dataset where I am going to delete rows/data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;brutal3239&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 09:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/399434#M96742</guid>
      <dc:creator>brutal3239</dc:creator>
      <dc:date>2017-09-28T09:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting data rows without affecting indexes or keys</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/399645#M96815</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/109676"&gt;@brutal3239&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"It worked. However, it is in work library. I want to do it directly to the dataset where I am going to delete rows/data."&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;If you want it in a permanent library then simply create the new table in a permanent library: create table &lt;EM&gt;&amp;lt;libref&amp;gt;.&amp;lt;table name&amp;gt;&lt;/EM&gt; as ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;I want to do it directly to the dataset&lt;SPAN&gt;&amp;nbsp;"&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;A Proc SQL/DELETE will only logically delete the rows. If you want the data set size reduced then you need to re-create the table (i.e. using your current SQL CREATE statement).&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 21:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-data-rows-without-affecting-indexes-or-keys/m-p/399645#M96815</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-28T21:09:50Z</dc:date>
    </item>
  </channel>
</rss>

