Redirect temporary work files in SAS or Stata

Temporary work files (or "scratch files") created during SAS or Stata sessions may exhaust your available disk space. As a result, your session will terminate with an error message indicating you have insufficient disk space to complete the job. To avoid this problem, you can instruct SAS or Stata to redirect temporary work files to your Slate-Scratch directory.

  • Redirecting SAS work files: To redirect temporary work files created during an SAS session, add the -work option to your SAS command line to specify the path to the desired directory.

    For example, to redirect work files to your Slate-Scratch directory, on the command line, enter (replace username with your IU username and my_file.sas with the name of your SAS program):

    sas -work /N/scratch/username my_file.sas

    When your SAS session is complete, the resulting .log and .lst files will be stored in the default directory, and SAS will remove the redirected work files.

  • Redirecting Stata work files: To redirect temporary work files created during Stata sessions, set up the STATATMP environment variable to point to the desired directory. To make the setup permanent, add the STATATMP environment variable to the shell profile in your home directory (and then log out and log back in to activate the change).

    For example, to redirect Stata work files to your Slate-Scratch directory:

    • In bash, add these lines to the .bashrc file (replace username with your IU username):
      STATATMP="/N/scratch/username"
      export STATATMP
    • In tcsh, add this line to the .tcshrc file (replace username with your IU username):
      setenv STATATMP="/N/scratch/username"

This is document addl in the Knowledge Base.
Last modified on 2023-11-20 14:20:57.