BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
xliu1
Quartz | Level 8

I create a big dataset in SAS. Every time I run the sas programs, I notice that it takes about 50GB of my local disk space. So I always remove sas temporary files each time I quit sas session.  I usually do a search under C:\ drive, and sas temporary files will pop up. However, I cannot locate the file after I quit sas session today, and local disk space goes down to 49.3GB from 103GB after I modified this sas program. Any idea how to find this sas temporary file? Thanks!

xliu1_0-1603504978815.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
jimbarbour
Meteorite | Level 14

Where is the WORK library normally allocated? For example, my WORK location is X:\saswork with a auto generated sub folder.

 

You can find out your work lib location by running:

Proc OPTIONS OPTION=WORK;
RUN;

If you determine the high level folder, then close all SAS sessions, any sub folders that remain are "orphans", and you can delete them (and their contents) which should free up space.

 

You could still have utility files left, but Work is the first place to start.

 

Jim

 

View solution in original post

11 REPLIES 11
jimbarbour
Meteorite | Level 14
Are you running on Windows? If so, make sure you empty your recycle bin.

Jim
xliu1
Quartz | Level 8

Yes I am running on Windows. I did empty recycle bin but that did not help with disk cleanup.

jimbarbour
Meteorite | Level 14

Where is the WORK library normally allocated? For example, my WORK location is X:\saswork with a auto generated sub folder.

 

You can find out your work lib location by running:

Proc OPTIONS OPTION=WORK;
RUN;

If you determine the high level folder, then close all SAS sessions, any sub folders that remain are "orphans", and you can delete them (and their contents) which should free up space.

 

You could still have utility files left, but Work is the first place to start.

 

Jim

 

xliu1
Quartz | Level 8

Thanks for your response. I am able to locate sas temporary files using the sas codes in your response. I deleted all files under this temporary folder and free up about 55 GB disk space. 

 

 

jimbarbour
Meteorite | Level 14
Fantastic! 😊

Usually SAS is really good about cleaning up Work files, but, every once in a while, something goes wrong, so it's worth checking the Library location for "orphans."

Jim
LeonidBatkhan
Lapis Lazuli | Level 10

Another way to identify WORK (or any other SAS library) path is by using PATHNAME() function:

 

%let workpath = %sysfunc(pathname(WORK));
%put &=workpath;

This way you also capture this path into macro variable.

 

Or you can write it into a SAS data table for further processing:

data LOCATOR;
	length workpath $200;
	workpath = pathname('WORK');
run;

 

xliu1
Quartz | Level 8

Thanks!

SASKiwi
PROC Star

SAS's default behaviour is to remove your SAS WORK folder, including its contents,  when you close your SAS session. Are you not seeing that happen?

xliu1
Quartz | Level 8

The files in the work library are removed each time I quit sas session. But apparently they are saved somewhere on the hard drive. 

Kurt_Bremser
Super User

In your library list, right-click on WORK and let it display Properties. This will lead you to the root path for your WORK directories, so you can navigate there with Windows Explorer and manually remove all remnants from previous sessions.

 

Did you, at some point in your program, define a USER library?

xliu1
Quartz | Level 8

I usually do not define a user library, always use work library. I try to save disk space, and avoid running datasets placed on network drive. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 11 replies
  • 15296 views
  • 7 likes
  • 5 in conversation