Chapter Contents

Previous

Next
SAS Companion for the Microsoft Windows Environment

Introduction to SAS Files

This section briefly reviews SAS files, taking into account that your SAS files are stored in Windows. For additional information about SAS files, see SAS Language Reference: Dictionary.


What Is a SAS File?

The SAS System creates and uses a variety of specially structured files called SAS files. Although Windows manages the file for the SAS System by storing it, the operating system cannot process it. For example, you can list SAS files with the Windows Explorer, but you cannot use the Windows Notepad to edit SAS files. SAS files are different from external files. While external files can be processed by SAS statements and commands, they are not managed by the SAS System.

SAS files usually reside in SAS data libraries. Under Windows, a SAS library is simply a named collection of SAS files within one or more Windows folders that the SAS System can access. Each SAS data library has an access engine associated with it the first time that a file in the library is accessed. The engine name specifies the access method that the SAS System uses to process the files in the data library. SAS data libraries are described in detail in SAS Language Reference: Dictionary.

Various engines enable the SAS System to access different formats or versions of SAS files and other vendors' files. For this reason, the SAS System is said to have Multiple Engine Architecture. Multiple Engine Architecture, combined with conversion utilities, provides access to Version 8 files and SAS files created with previous releases of the SAS System (back to Version 5), whether they were created under Windows or other operating systems. Multiple Engine Architecture also provides access to files created by other vendors' products, including database files.

The following sections highlight information you need in order to create and use SAS files with the various engines under Windows.


Types of SAS Files

SAS files are stored in SAS data libraries and are referred to as members of a library. Each member has a member type. The SAS System distinguishes between SAS files and external Windows files in a folder by using unique file extensions. The SAS System assigns certain file extensions to a general set of SAS member types. Windows File Extensions and Their Corresponding SAS Member Types lists the Windows file extensions and their corresponding SAS member types for the V6, V7, and V8 engines. For more information about engines, see Multiple Engine Architecture.

Windows File Extensions and Their Corresponding SAS Member Types
V6 File Extension V7 and V8 File Exension (Short) V7 and V8 File Extension (Long) SAS Member Type Description
.sas .sas .sas none SAS program
.ss2 .ss7 .sas7bpgm Program stored program (DATA step)
.lst .lst .lst none output file
.log .log .log none log file
none .st7 .sas7baud Audit audit file
.sd2 .sd7 .sas7bdat Data data set
.sv2 .sv7 .sas7bvew View data set view
.si2 .si7 .sas7bndx Index data set index. Indexes are stored as separate files but are treated by the SAS System as integral parts of the SAS data file.
.sc2 .sc7 .sas7bcat Catalog SAS catalog
.sa2 .sa7 .sas7bacs Access access descriptor file
.sf2 .sf7 .sas7bfdb FDB consolidation database file
.sm2 .sm7 .sas7bmdb MDDB multi-dimensional database file
none .s7m .sas7bdmd DMDB data mining database file
none .sr7 .sas7bitm Itemstor item store file
.su2 .su7 .sas7butl Utility utility file
.sp2 .sp7 .sas7bput Utiltiy permanent utility
.stx .stx none none transport file
none .sb7 .sas7bbak none backup file

CAUTION:
Do not change the file extension of a SAS file; doing so can cause unpredictable results. The file extensions assigned by the SAS System to SAS files are an integral part of how the SAS System accesses these files. Also, you should not change the filename of a SAS file using operating system commands. If you want to change the name of a SAS file, use the DATASETS procedure or select the file in the SAS Explorer window and select

Edit
[arrow]
Rename...
  [cautionend]

Note:   You may see files with other file extensions in your WORK and SASUSER data libraries. Most of these are temporary utility files that you do not need to access directly; be sure not to delete any of them during your SAS session.

If for some reason your SAS session ends abnormally, you might need to delete these files, outside of the SAS System, in order to regain disk space.  [cautionend]

Using Short or Long File Extensions in SAS Libraries

Version 8 libraries can either be short file extension libraries or long file extension libraries. Although the Windows operating environment and the SAS System for Version 8 support long file names, short file extension libraries are necessary for accessing libraries residing on servers that supports only short file extensions.

You can specify whether the library supports short or long file extensions on the LIBNAME statement. For example, if your SAS library is on a server mapped as the S drive and the server file system supports only short file extensions, your libname statement would look similar to this:

libname mylib 's:\sasv6' shortfileext;
For information on specifying short or long file extensions using the LIBNAME statement, see LIBNAME.

If SAS is not able to create a file with a long file extension the first time it writes to a library, then the library supports only files with short file extensions. If you specify a file with a long file extension for a library that supports only short file extensions, an error message informs you that the member name is too long for the system.

SAS Data Sets (Member Type: Data or View)

SAS data set is an umbrella term for SAS data files and SAS data views, which are both discussed here. This section provides a brief overview of the concept of SAS data sets. For complete details, see the data sets section in SAS Language Reference: Concepts.

Logically, a SAS data set consists of two types of information: descriptor information and data values. The descriptor information includes such things as data set name, data set type, data set label, and number of variables, as well as the names and labels of the variables in the data set, their types (character or numeric), their length, their position within a record, and their formats. The data values contain values for the variables. A SAS data set can be visualized as a table consisting of rows of observations and columns of variable values. SAS Data Set Model illustrates the SAS data set model.

SAS Data Set Model

[IMAGE]

SAS data files (member type: Data)
The SAS data file is probably the most frequently used type of SAS file. SAS data files have a SAS member type of Data and are created in the DATA step and by certain SAS procedures such as the RANK procedure in base SAS software.

The SAS System defines two types of SAS data files, native and interface. Native data files store data values and descriptor information, as described earlier, in files formatted by the SAS System. These are the SAS data sets you may be familiar with from previous versions of the SAS System under other operating systems. In the SAS System under Windows, native SAS data files can be indexed. The index is an auxiliary file created in addition to the SAS data file. The index provides fast access to records within a SAS data file through a variable or key. Indexes are stored as separate files but are treated by the SAS System as integral parts of the SAS data file.

The second type of data file is the interface SAS data file. These files store data in a file formatted by other software. Examples of interface SAS data files are BMDP, OSIRIS and SPSS files, which the SAS System can access as read-only files. For more information, see Reading BMDP, OSIRIS and SPSS Files.

In most cases, the maximum file size for a SAS data set is 2 gigabytes (GB). However, if you run the SAS System under Windows NT and store your data on a volume formatted with the Windows NT file system (NTFS), you can create and store data sets larger than 2GB. For more information about this feature and its uses, see Using Large Data Sets with Windows NT and NTFS.

For information about the size limitation of a data set under Windows, see Length and Precision of Variables under Windows.

SAS data views (member type: View)
SAS data views have a member type of View. They describe data values and tell the SAS System where to find the values, but they do not contain the actual data values themselves.

Views may be of two kinds, native or interface. A native SAS data view is created with the SQL procedure or with the DATA step and describes a subset or combination of the data in one or more SAS data files or SAS data views. For information on SQL views, see the SAS Procedures Guide. For information on DATA step views, see SAS Language Reference: Dictionary.

Interface SAS data views contain descriptor information for data formatted by other software products, for example, a database management system. Such a view is created with the ACCESS procedure in SAS/ACCESS software. For more information, see SAS/ACCESS Software for PC File Formats: Reference and other available SAS/ACCESS documentation.


SAS Catalogs (Member Type: Catalog)

A SAS catalog is a special type of SAS file that can contain multiple entries. You can keep different types of entries in the same SAS catalog. For example, catalogs can contain windowing applications, key definitions, toolbox definitions, SAS/GRAPH graphs, SAS/IML matrices, and so on.

If you want to use Version 8 to access catalogs created with earlier releases of the SAS System for Windows 95 or Windows NT, you must first convert the catalogs from the earlier releases to Version 8 format before you can use them in a Version 8 SAS program.

For more information on how to convert SAS catalogs, see Moving and Accessing SAS Files across Operating Environments.

SAS Stored Program Files (Member Type: Program)

A stored program file is a compiled DATA step generated by the Stored Program Facility. For more information about this type of SAS file, see SAS Language Reference: Concepts.

Access Descriptor Files (Member Type: Access)

Descriptor files created by the ACCESS procedure in SAS/ACCESS software have a member type of ACCESS and are used when creating interface SAS data views. Descriptor files describe the data formatted by other software products supported by the SAS System under Windows. For more information, see SAS/ACCESS Software for PC File Formats: Reference and other available SAS/ACCESS documentation.


Using Large Data Sets with Windows NT and NTFS

If you run SAS under Windows NT and store your data on a disk volume formatted with the Windows NT file system (NTFS), SAS automatically takes advantage of the 64-bit file I/O features. As a result, you can create, sort, and subset data sets greater than the 2 gigabyte size limit placed on other Windows environments. (The size limit for a SAS data set under Windows NT with NTFS is 4 giga-gigabytes, or 262 bytes.)

Note that while you can access the full data set from SAS under Windows NT, other users running SAS under Windows 95 are able to access only the first 2 gigabytes (thus causing unpredictable results).


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.