<?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 in SAS DIS in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428579#M13213</link>
    <description>&lt;P&gt;Extracting the rows and writing them back to the same table (really a SAS data set, I assume) won't help you because in order to make the file smaller it must be recreated using a SAS DATA step, PROC APPEND, etc. This removes the unused space in the file. If you recreate the file using COMPRESS=yes and REUSE=yes then space will be reused. But as Linus points out, it is a good idea to periodically recreate the file to clean the space up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The referential integrity can be dropped while maintenance is performed on the table. Once the work is done, the referential integrity can be reapplied. Keep in mind, if the data violates the constrains it will cause an error when reapplied.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been playing around with some code that shows how to make a file smaller. Hopefully, it will help somebody. I plan to take it and create a communities article on it at some point. In DI Studio you can use the APPEND transform to do a lot of this. I assume there is a way to rename a SAS data set; I don't know which transform will do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname prod "C:\sasdata\prod";
libname stage "C:\sasdata\stage";

/* Create a 1GB SAS data set */
data prod.slackspace;
   do i = 1 to 10000000;
      x='abcdefghijklmnopqrstuvwxyz0123456789';
      y='abcdefghijklmnopqrstuvwxyz0123456789';
      z='abcdefghijklmnopqrstuvwxyz0123456789';
      output;
   end;
run;

/* DELETE all the observations from the 1GB SAS data set to see if it gets smaller */
proc sql;
   delete from prod.slackspace;
   select count(*) from prod.slackspace;
quit;
&lt;BR /&gt;/* At this point the select count(*) returns 0 */&lt;BR /&gt;/* The file is still 1GB */
/* CREATE TABLE AS to see if the new SAS data set is smaller - it will be 128K */
proc sql;
   create table stage.noslack_sql as select * from prod.slackspace;
run;

/* Create new table using PROC APPEND to see if the new SAS data set is smaller */
proc append base=stage.noslack_append data=prod.slackspace;
run;

/* Create new table using a DATA step to see if the new SAS data set is smaller */
data stage.noslack_datastep;
   set prod.slackspace;
run;

/* Verify the sizes */
proc datasets lib=prod; 
run;
proc datasets lib=stage;
run;

/* For production... */

/* Remove wasted space */
/* Use two libraries pointing to different devices for performance.*/&lt;BR /&gt;/* This prevents simultaneous reads and writes to the same device. */&lt;BR /&gt;/* Ignore the fact that I am on a laptop;)&lt;BR /&gt;
proc append base=stage.slackspace_small data=prod.slackspace;
run;

/* move smaller file back into production - give it the original name */
proc datasets lib=prod;
   change slackspace=slackspace_old;
   copy in=stage out=prod move;
   change slackspace_small=slackspace;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best wishes,&lt;/P&gt;
&lt;P&gt;Jeff&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jan 2018 20:02:56 GMT</pubDate>
    <dc:creator>JBailey</dc:creator>
    <dc:date>2018-01-17T20:02:56Z</dc:date>
    <item>
      <title>Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427015#M13156</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you think is the best practice to delete rows from a SAS table in SAS DIS? I need to delete historical data but with delete statement we don't save any space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does it work to create a job where we extract (extract transformation) the data we want to keep and then load it to the same table (table loader transformation)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions are welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May15.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 21:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427015#M13156</guid>
      <dc:creator>May15</dc:creator>
      <dc:date>2018-01-11T21:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427448#M13170</link>
      <description>From DIS perspective your suggestion would probably work, just your exact need to result in a table rather than a view (otherwise you are trying to write to a tabel atbthe same time reading from it).&lt;BR /&gt;If it's a good idea depends on your constraints  (disk, up, processing time).</description>
      <pubDate>Sat, 13 Jan 2018 15:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427448#M13170</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-01-13T15:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427632#M13178</link>
      <description>&lt;P&gt;Hi LinusH,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried but it doesn't work. I've got the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Attempt to append a view to itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it results in a table, not in a view. I don't know if I understood the restriction you've said.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May 15&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2018 09:59:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427632#M13178</guid>
      <dc:creator>May15</dc:creator>
      <dc:date>2018-01-15T09:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427634#M13180</link>
      <description>I don't know either. Show a view of your job an the code generated for the extract transformation.</description>
      <pubDate>Mon, 15 Jan 2018 10:02:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427634#M13180</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-01-15T10:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427726#M13189</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/152882"&gt;@May15&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are talking about deleting observations from a SAS data set this might help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS uses lazy deletes. This means that the observation in the file is marked as deleted but it remains in the file. This is why the delete statement has no affect on the size of the SAS data set. If your file is really small you may not see a reduction in size, at all.&amp;nbsp;The only way that I know of to reduce the size of the file is to make a copy of it using a SAS tool (PROC COPY, DATA step, PROC SQL, etc).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data small;
   x=1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code results in a file that is 128K. Deleting this single row, then copying the SAS data set via a SAS tool, will not change the size of the file because it is so small.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using DI Studio you could:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a new file containing the data you want (smaller than the original)&lt;/LI&gt;
&lt;LI&gt;Delete the original SAS data set (if you want to play it safe this file can be renamed instead of deleted)&lt;/LI&gt;
&lt;LI&gt;Rename the new data set to the old name&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Compressed SAS datasets behave a little differently. Here's a SAS Note with more details:&amp;nbsp;&lt;A href="http://support.sas.com/kb/32/042.html" target="_blank"&gt;http://support.sas.com/kb/32/042.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Jeff&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 15:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427726#M13189</guid>
      <dc:creator>JBailey</dc:creator>
      <dc:date>2018-02-13T15:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427818#M13191</link>
      <description>&lt;P&gt;Hi LinusH,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've found the issue... The extract transformation had the option "Create as view" checked. I unchecked this and now it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way, using this approach, we don't lose any constraints and indexes of the data, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May15&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2018 20:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427818#M13191</guid>
      <dc:creator>May15</dc:creator>
      <dc:date>2018-01-15T20:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427820#M13192</link>
      <description>&lt;P&gt;Hi JBailey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your tips. In fact, it's a shame that the delete transformation doesn't save any space.&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;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May15&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2018 20:13:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/427820#M13192</guid>
      <dc:creator>May15</dc:creator>
      <dc:date>2018-01-15T20:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428067#M13196</link>
      <description>That depends on the settings in the Table Loader.&lt;BR /&gt;But test the job and analyze results, as a normal development and unit test.</description>
      <pubDate>Tue, 16 Jan 2018 16:05:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428067#M13196</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-01-16T16:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428137#M13198</link>
      <description>&lt;P&gt;Sure LinusH.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May15&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 19:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428137#M13198</guid>
      <dc:creator>May15</dc:creator>
      <dc:date>2018-01-16T19:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428188#M13200</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/152882"&gt;@May15&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My pleasure. Hopefully it answers the question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The transformation only issues the DELETE code and it must work regardless of data source. The clearing of "slack" space in a SAS data set could be set up in a different process and run periodically.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best wishes,&lt;BR /&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 22:08:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428188#M13200</guid>
      <dc:creator>JBailey</dc:creator>
      <dc:date>2018-01-16T22:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428213#M13201</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/51161"&gt;@JBailey&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me ask, what yould you suggest to clear the "slack" space in a SAS data set?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May15&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 23:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428213#M13201</guid>
      <dc:creator>May15</dc:creator>
      <dc:date>2018-01-16T23:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428272#M13202</link>
      <description>You can have it defined with the REUSE data set option. Will save some space but eventually over time the internal storage will be scattered, so a total rewrite of the table now and then is recommended.</description>
      <pubDate>Wed, 17 Jan 2018 07:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428272#M13202</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-01-17T07:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428560#M13212</link>
      <description>&lt;P&gt;Hi all again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, the idea I've posted in the original post isn't working. I'm getting the following errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;WARNING: Target table is referenced by constraints in another table&lt;/DIV&gt;&lt;DIV&gt;WARNING: Replacing entire table will fail. Consider an alternate load technique or revising constraints.&lt;/DIV&gt;&lt;DIV&gt;ERROR: A rename/delete/replace attempt is not allowed for a data set involved in a referential integrity constraint.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In fact, this table has a primary key which is related to a foreign key in another table and also has a foreign key that is related to a primary key in another table.&lt;/DIV&gt;&lt;DIV&gt;Just to remember, in order to save space, the process is to extract only the data I want and then load it to the same table. The load process was done with the table loader transformatin using the "Replace" style and with the default constraint conditions:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Before load: On table creation&lt;/DIV&gt;&lt;DIV&gt;After load: Leave on&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any help to solve this issue??&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;May15&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 17 Jan 2018 19:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428560#M13212</guid>
      <dc:creator>May15</dc:creator>
      <dc:date>2018-01-17T19:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428579#M13213</link>
      <description>&lt;P&gt;Extracting the rows and writing them back to the same table (really a SAS data set, I assume) won't help you because in order to make the file smaller it must be recreated using a SAS DATA step, PROC APPEND, etc. This removes the unused space in the file. If you recreate the file using COMPRESS=yes and REUSE=yes then space will be reused. But as Linus points out, it is a good idea to periodically recreate the file to clean the space up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The referential integrity can be dropped while maintenance is performed on the table. Once the work is done, the referential integrity can be reapplied. Keep in mind, if the data violates the constrains it will cause an error when reapplied.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been playing around with some code that shows how to make a file smaller. Hopefully, it will help somebody. I plan to take it and create a communities article on it at some point. In DI Studio you can use the APPEND transform to do a lot of this. I assume there is a way to rename a SAS data set; I don't know which transform will do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname prod "C:\sasdata\prod";
libname stage "C:\sasdata\stage";

/* Create a 1GB SAS data set */
data prod.slackspace;
   do i = 1 to 10000000;
      x='abcdefghijklmnopqrstuvwxyz0123456789';
      y='abcdefghijklmnopqrstuvwxyz0123456789';
      z='abcdefghijklmnopqrstuvwxyz0123456789';
      output;
   end;
run;

/* DELETE all the observations from the 1GB SAS data set to see if it gets smaller */
proc sql;
   delete from prod.slackspace;
   select count(*) from prod.slackspace;
quit;
&lt;BR /&gt;/* At this point the select count(*) returns 0 */&lt;BR /&gt;/* The file is still 1GB */
/* CREATE TABLE AS to see if the new SAS data set is smaller - it will be 128K */
proc sql;
   create table stage.noslack_sql as select * from prod.slackspace;
run;

/* Create new table using PROC APPEND to see if the new SAS data set is smaller */
proc append base=stage.noslack_append data=prod.slackspace;
run;

/* Create new table using a DATA step to see if the new SAS data set is smaller */
data stage.noslack_datastep;
   set prod.slackspace;
run;

/* Verify the sizes */
proc datasets lib=prod; 
run;
proc datasets lib=stage;
run;

/* For production... */

/* Remove wasted space */
/* Use two libraries pointing to different devices for performance.*/&lt;BR /&gt;/* This prevents simultaneous reads and writes to the same device. */&lt;BR /&gt;/* Ignore the fact that I am on a laptop;)&lt;BR /&gt;
proc append base=stage.slackspace_small data=prod.slackspace;
run;

/* move smaller file back into production - give it the original name */
proc datasets lib=prod;
   change slackspace=slackspace_old;
   copy in=stage out=prod move;
   change slackspace_small=slackspace;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best wishes,&lt;/P&gt;
&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 20:02:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428579#M13213</guid>
      <dc:creator>JBailey</dc:creator>
      <dc:date>2018-01-17T20:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428586#M13214</link>
      <description>&lt;P&gt;Why is&amp;nbsp;it "a shame that the delete transformation doesn't save any space"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider a dataset with 100M observations stored in,say, 5M physical data set disk pages (of 64K bytes each).&amp;nbsp; You delete the first observation, requiring the reading and re-writing of all 5M pages.&amp;nbsp;&amp;nbsp;This is no different than a PROC SQL, DATA step, PROC COPY etc.&amp;nbsp; Logical deletion is the superior way to go in such a case.&amp;nbsp; Yes, at some point if enough obs have been marked as deleted, it might make send to copy to a smaller disk usage, but making that behavior automatic is not necessarily cost effective.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suppose some data bases offer an immediate&amp;nbsp;reduction in disk storage with every row eliminated, but I imagine to do so,&amp;nbsp;those databases are all accessed via indexes.&amp;nbsp; I suspect they do not&amp;nbsp;offer the rapid sequential read capabilities of SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 20:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428586#M13214</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-01-17T20:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428608#M13215</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/51161"&gt;@JBailey&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for sharing your code.&lt;/P&gt;&lt;P&gt;One question, why do you say it doesn't help me? Actually, the process I mentioned works in order to make the file smaller: I've tested it. To replace the original table with the data I want, the table loader transformation in SAS DIS generates a proq sql with the CREATE TABLE AS statement and, as you also checked in your code, it saves space. The issue, as I said above, is when I have referential integrity constraints. Thus, I'd like to know what I could change in this kind of process in DIS to eliminate the errors I mentioned above. Any help will be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;, thanks for your point of view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May15&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 21:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428608#M13215</guid>
      <dc:creator>May15</dc:creator>
      <dc:date>2018-01-17T21:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428610#M13216</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/152882"&gt;@May15&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I meant it doesn't help with INSERTing back into the original table. For it to work the original table (really a file) must be replaced with a new version.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In order to do this on a table with RI ,the RI must be dropped prior to the maintenance then reapplied afterward.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best wishes,&lt;/P&gt;
&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 21:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428610#M13216</guid>
      <dc:creator>JBailey</dc:creator>
      <dc:date>2018-01-17T21:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428634#M13217</link>
      <description>&lt;P&gt;FWIW, here's a little script to tell you how much disk space you might recover via PROC COPY, etc..&amp;nbsp; Perhaps DIS already has this capability via some other instruction, but my familiarity is with Base SAS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars;
  set sashelp.cars;
run;

data cars;
  modify cars;
  if mod(_n_,10)=3 then remove;
run;

proc sql;
  select nobs
        ,nlobs
        ,nobs-nlobs as removed_obs
        ,calculated removed_obs/nobs as proportion_removed
        ,obslen
        ,obslen * calculated removed_obs as potential_disk_savings
  from dictionary.tables
    where libname='WORK' and memname='CARS';
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jan 2018 22:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/428634#M13217</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-01-17T22:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting rows in SAS DIS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/429027#M13236</link>
      <description>Is it just me, but all this sounds a bit awkward. &lt;BR /&gt;First, what is the delete ratio? How often do you delete?&lt;BR /&gt;I usually don't come across this kind of situation when working on governed data like you seem to have with  constraints and all. In my work you keep all the data, and only reason more deletions are archiving  (seldom perhaps once a year, monthly at the most), or manual data patching of a misload. &lt;BR /&gt;If you still have step g requirements for this kind of operations Base SAS may not be the best match for storage.</description>
      <pubDate>Fri, 19 Jan 2018 07:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Deleting-rows-in-SAS-DIS/m-p/429027#M13236</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-01-19T07:38:37Z</dc:date>
    </item>
  </channel>
</rss>

