Section 1.7: Types of SAS Files The recommended way to run most SAS applications is to store commands in a program file and then pass it to the SAS processor either in batch mode (unix) or through the full-screen editor (PC). On the PC the file containing the program commands is automatically given the .sas extension to its name when saved from the window editor. On unix or with any external text editor, you must save the file as 'plain text' and then change the suffix of the file name so that it ends with sas, e.g., my_file.sas is the typical convention. From these sas programs, other files are produced, as needed, so be sure to document them well and store backups in a safe place. SAS file names are based on two-levels for the various types of files, each having a prefix and a suffix as follows: 1. SAS program .sas - SAS program commands written by user (it is automatically added by PC editor) 2. SAS log .log - Summary of what SAS did with program -- ALWAYS check the LOG file or window! Various options exist to minimize or maximize information written to the log file, such as mprint, symbolgen, notes, etc. These will be further explained under Chapter 3 for SAS options. The Log file should not contain any system Error/Warning messages, especially anything you see printed in red on the PC. In the PC version of SAS you can clear the log window contents with the command: dm "clear log"; You may also direct the log window contents to an external file with: PROC PRINTTO LOG = "c:\sas\log.txt" NEW; RUN; A good resource on how to interpret the log file is: Program Validation: Logging the Log Adel Fahmy, Symbiance Inc., Princeton, NJ which may be read at: http://www.nesug.org/html/Proceedings/nesug04/ap/ap09.pdf One note you won’t see in a LOG file, that perhaps should implicitly always be there, is: "No claim is made that any of this report has validity and the programmer is irresponsible" (Ian Whitlock) 3. SAS output .lst - (DARKWING/GLADSTONE) contains all printed output from the program 4a. Version 8 and 9 permanent SAS dataset names .sas7bdat - Permanent SAS data sets written with the DATA step on DARKWING/GLADSTONE/OREGON .sas7bdat or .sd7 - Permanent SAS data sets written with the DATA step for Windows SAS Version 8 anmd 9 permanent SAS dataset filenames have a different filename extension than Version 6. The new filename extension for SAS datasets written on WINDOWS, DARKWING, or GLADSTONE is: .sas7bdat SAS uses long filename extensions by default on file systems that support them. When both long and short extensions are mixed in the same directory, it uses a shorter name: .sd7 4b. In case you still see them, version 6 assigned permanent SAS datasets with these naming conventions: .ssd01 - Permanent SAS data sets written with the DATA step on DARKWING/GLADSTONE (unix) .sd7 - Permanent SAS data sets written with the DATA step on a PC The file name extension actually given by SAS to the permanent data set depends upon the presence of existing version 6 data sets in the directory. If no version 6 datasets exist, SAS assigns Version 8 names in the directory. 5. ASCII (text) data file types written by Excel - Excel workbook (with single worksheet of same name found in lower-left-hand tab) - comma separated value file - space separated file - tab separated file If you think in terms of these suffix names it will help you to keep track of the different file types regarding their formats and contents. Always use the *.sas suffix (be sure to use lower case letters on unix systems) to quickly identify files containing SAS commands.