Monday, 6 June 2011

Cleaning temporary files

Experienced sas users usually know where to find the work folder and how to clean it manually. Now there is an elegant solution for Windows – at long last.

Usually when the sas session is terminated, the application does some house cleaning. When the session is abandoned abruptly the work folder and its contents are left on the disk.  In time these temporary files may clog up the file storage and slowdown the box. A Unix cleanup scrip has been around for a good decade or so but when it came to The Windows operating systems I used to occasionally purge the files manually. However, now there is a utility that not only cleans the work folders but also a little bit more.

Note: Another container for unexpected file clutter is the sasuser folder. Mine is C:\Documents and Settings\eli\My Documents\My SAS Files\sasuser. A sloppy programmer will find there their output from SGplot and HTML reports accumulating rapidly.

How do I know the physical path to the work folder?


The standard installation will store all the work subfolders under C:\DOCUME~1\<windoes user id>\LOCALS~1\Temp\SAS Temporary Files. I have a desktop shortcut pointing there and occasionally I manually delete the subfolders there.

The simple way is to right mouse click the properties of work library:


Alternatively submit
proc options option=work; run;

and  the result will show in the log window.

A slightly more sophisticated and elegant way is:

                               %let WorkPath = %sysfunc(getoption(work));
%put <<&WorkPath.>>;

How do run and schedule the cleanup utility?

This cool utility is available with sas9.2 and works only if .Net Framework 2.0 is installed. The cool thing about this is that it is a bolton to the windows ‘Disk Cleanup’ utility. Once installed all you have to do is call the ‘Disk Cleanup’ utility (from Explorer, Select My Computer, right-Click on a local physical hard disk, and select Properties>Disk Cleanup) and then ensure there is a checkmark next to “SAS Temporary Files”


I did not have the utility installed so I found where to download it mentioned in this sas note: http://support.sas.com/kb/8/786.html.

No comments:

Post a Comment