DATA Step, Macro, Functions and more

PROC SQL - DELETE FROM TABLE

Reply
Contributor
Posts: 60

PROC SQL - DELETE FROM TABLE

When I use PROC SQL; DELETE FROM TABLE; i see that sas file is constantly increasing. How can I enforce (with some option perhaps) to delete recordes permanently and free the disk space?

Respected Advisor
Posts: 3,156

PROC SQL - DELETE FROM TABLE

I am not sure if this is relevant: if I use system options compress=yes, and then after I delete some records, the file size remains the same, unless you invoke another system option: reuse=yes.

So it would look like this:

options compress=yes;

options reuse=yes;

What it does is to reuse those vacant slots from deleted records instead of appending to the end.

BTW, these two options are also data set options as well.

Regards,

Haikuo

Super User
Posts: 10,023

PROC SQL - DELETE FROM TABLE

I don't understand what you mean.

If you want delete a table ,then use DROP TABLE

If you want keep the constructure of a table ,then use CREAT TABLE xx LIKE xx, then drop the original table.

Ksharp

Frequent Contributor
Posts: 139

PROC SQL - DELETE FROM TABLE

Example of your query and what you are trying to achieve? Please elaborate

Contributor
Posts: 60

PROC SQL - DELETE FROM TABLE

I've got table T1.

When I delete all record from it (Proc sql; Delete from T1Smiley Wink the table size doesn't decrease. Moreover, when I put some records in this table I see that record number shows as If there were some "invisible records" inside. System seems to keep deleted record which take disk space and when iserting new records the table size is contantly growing..

Frequent Contributor
Posts: 139

PROC SQL - DELETE FROM TABLE

when you delete all records from table , try seeing contents of dataset and see if you can see that or not.

Super User
Posts: 10,023

PROC SQL - DELETE FROM TABLE

Then you tried the way HaiKuo proposed?

Super User
Super User
Posts: 7,039

PROC SQL - DELETE FROM TABLE

You seem to have figured out how SAS works when you delete records without recreating the dataset.  If it is a concern to you then recreate the dataset.  (data old; set old; runSmiley Wink

Ask a Question
Discussion stats
  • 7 replies
  • 1234 views
  • 0 likes
  • 5 in conversation