BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I had 1 million observations in a SAS dataset and the size of it was 8 GB. Later on , I deleted all observations except one . Even then the size of the dataset was still 8 GB. This dataset is used in a SAS DI studio job, and because of this size problem the job fails.
Has anybody faced anything like this?
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
If you do a delete in place, SAS does not free the space. Make a copy and just select one observation and it will adjust the space:

DATA new; SET old; IF _N_=1; RUN;
or even
DATA perm.million; SET perm.million; IF _n_=1; RUN;

would adjust the disk space size.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
It is true that the entire SAS data library's disk space usage is not reduced when a SAS member is reduced in size, however SAS does a fine job managing the space within the data library - much better than back in the day of SAS 5.18 and earlier (82.3 and 79.6). Review the PROC CONTENTS or DATASETS output for the data library and each member for details - sample SAS code to demonstrate is provided below.

And, so, the only way to reclaim the disk space (and reduce the SAS-used high watermark) is to copy out the entire library, delete it, and copy it back as a new allocation.

Scott Barry
SBBWorks, Inc.

options compress=no;
data x;
retain a1-a100 'xxxxxxxxxxxxxxxxxxxxx';
do i=1 to 1e6;
output;
end;
run;
proc datasets lib=work;
run;
data x;
set x;
output;
stop;
run;
proc datasets lib=work;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1011 views
  • 0 likes
  • 3 in conversation