General Guidelines: File Management

"Files" can refer to data sets (both SAS and non-SAS), as well as to other types such as the ASCII files generated when SAS programs are saved from the Program Editor window or when material is saved from the Log and Output windows.

Right-clicking on a file will yield the file properties while double-clicking with the left button will open the file. SAS data files generated in SAS version 9.1 will normally have ".sd7" as an extension and SAS catalog files will have a ".sc7" extension.

The following section covers saving, organizing, and documenting files.


When saving files within the Program Editor, Log, or Output windows, the File/Save As option will automatically create the following file extensions: ".sas" for SAS programs created in the program editor window, ".log" for output from the log window, and ".lst" for material generated in the output window. The Results Window can also be used to view, save, and manage individual results which appear in the Output Window.

Material entered within a window should be saved at periodic intervals (e.g., every 10 minutes). This can be set up automatically with the autosave option in the Tools menu (Options/Preferences/Edit). It is not necessary to save logs and outputs as long as the programs and data that produce them are saved (for important runs, however, it may be desirable to save such files, in addition to generating a paper copy).


A "My SAS Files" directory is automatically created upon installation of SAS Version 9.1; the location may vary with the operating system. Windows Explorer, which can be invoked using the button at the top of the SAS Window display (/Tools/Find), can be used to find the exact path of this directory (in the Advanced menu, specify Folders rather than Files and Folders, and in the Name and Location menu enter SAS as the search string). The user could then set up, for example, one directory per project, with separate subdirectories under each project directory for SAS programs, logs, output, and data sets.

Libraries refer to the physical location where SAS files are stored. By default, several libraries are already defined by SAS:

  1. WORK - used by SAS for storage of temporary files.
  2. MAPS - contains SAS maps for most countries in the world. These maps are used with the SAS GMAP procedure.
  3. SASUSER - automatically generated by SAS to save SAS default settings.
  4. SASHELP - contains the SAS help catalogs; they are views (a type of data set) that describe every active library, data base, and catalog.

Data should not be stored in any of the default libraries; however, new libraries can be defined so that they, too, are automatically created each time SAS is started up (by specifying enable at startup when first created).

To assist in specifying to SAS where a particular file is located, a one-word reference can be assigned for the path of the file, particularly useful when the path involves a long list of sub-directories. The LIBNAME statement can be used, for example to assign a library called mydir to represent c:\My Documents\My SAS Files\projects\ami. To direct SAS to a particular data set (e.g., amidata.sd7 in the ami directory), the user could simply specify mydir.amidata (the SAS data set extension does not need to be specified).


Documentation of both SAS programs and SAS output such as graphs and tables is essential for effective management of files. For programs, comment lines are useful for basic file documentation and for explaining what certain sections/lines of SAS code are intended to accomplish. For output, titles and footnotes can provide useful information such as project title, type of analysis, type of data, and what exclusions may have been made, instead of having, for example, the default "The SAS System" at the top of each page of output.

 << Previous


 Next >>