Running the Cleanwork Utility
The SAS Cleanwork utility is a tool that is bundled with SAS Foundation software. Basically, the tool allows orphaned work libraries to be removed.
When SAS is initialised, a directory is created on the host that is running SAS (be it a server or a desktop installation) to hold the contents of the work library. Under normal circumstances this folder is deleted when the SAS session is terminated, however, if SAS is not closed normally then the folder and its contents are not deleted and remain in place (unless deleted manually). Over time, these orphaned work libraries can accumulate and consume the disk space available to the SAS work library. This is more commonly an issue on SAS servers where many users are sharing the same work space.
When invoked, the Cleanwork utility scans the work location(s) and deletes any folders that are not associated to a live SAS session.
Executing on Windows
The executable for the Cleanwork utility is located in:
SASHome\SASFoundation\9.4\cleanwork.exe
To execute the SAS Cleanwork utility, the executable must be invoked from a command line with the appropriate options, for example:
\SASHome\SASFoundation\9.4\cleanwork.exe /d C:\SASWORK
Here the /d switch specifies a folder(s) to scan for SAS related files. Other options include:
- /list to list out the items to be deleted
- /v to specify an entire volume rather than a specific folder
Running the executable with no options specified will list further options.
Executing on Linux
The executable for the Cleanwork utility is located in:
sashome/SASFoundation/9.4/utilities/bin/cleanwork
To execute the SAS Cleanwork utility, the executable must be invoked from a command line with the appropriate options. For example:
sashome/SASFoundation/9.4/utilities/bin/cleanwork /tmp/SASWORK
Here, the first argument specifies a directory(s) to scan for SAS related files. Other options include, -n to list the directories that contain entries that can be removed.
Automation
In both of the above examples it is possible to set up automated processes to run the Cleanwork utility at regular intervals. This is advisable on server architectures where a large user base is more likely to generate orphaned work libraries.