The MCHP SAS MANUAL - File Management

         

Home    Contents

GENERAL GUIDELINES:
Windows in SAS
File management

The SAS Program
Program syntax
Debugging tips


 USING SAS PROGRAMMING TO: 
   
1. Prepare the data set 
   Types of data 
   Example programs    
    
2. View the data
   SAS Procedures
  
3. Explore the data  
   Numeric statistics    
   Frequency tables    
    
4. Manipulate the data  
   Basic techniques    
   New variables
  
5. Adding Variables and 
Observations to Data Sets
   The SET Statement
   The MERGE Statement

6. Data Processing
   ARRAY Statement
   Do Loops
   By-Group Processing
   RETAIN Statement
  
NON-PROGRAMMING 
      Alternatives

 
SAMPLE DATA SETS: 
 Height/weight
 Height/weight/region
 Simulated clinical data 
 Simulated Manitoba Health 
    

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.

SAVING 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).

ORGANIZING FILES

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).

DOCUMENTING FILES

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.

Home
General Guidelines: Windows
NEXT
The SAS Program: Syntax

Contact: Charles Burchill       Telephone: (204) 789-3429
Manitoba Centre for Health Policy
Department of Community Health Sciences, University of Manitoba
4th floor Brodie Centre
408 - 727 McDermot Avenue
Winnipeg, Manitoba R3E 3P5       Fax: (204) 789-3910
Last modified on Monday, 12-Sep-2005 11:52:01 CDT