Chapter Contents

Previous

Next
SAS/CONNECT User's Guide

Mixing Cross-Version Data Files in a Library

Whenever possible, it is generally recommended that you keep Version 6 and Version 7 or Version 8 SAS files in separate physical locations. This will avoid any potential confusion as to which file is being accessed. If mixed versions are stored in the same library, the appropriate engine should be specified when accessing the SAS data files.

Your ability to access a specific file in a library depends on the engine associated with that library. You can explicitly specify the engine using the LIBNAME statement, or you can allow SAS to determine the appropriate engine for you based on the version of the session and the files in the directory. For example, a Version 7 session will attempt to use the Version 7 engine (V7), and a Version 8 session will attempt to use the Version 8 engine (V8).

Note:   A V7 engine and a V8 engine are identical.  [cautionend]
However, if a physical library contains only Version 6 files, the Version 7 or Version 8 session uses the Version 6 engine (V6) to access the SAS files in that library.

If a library contains both Version 6 files and Version 7 or Version 8 files, the Version 7 or Version 8 session may never see the Version 6 files if the V7 or V8 engine is used. If the V6 engine is specified, the Version 7 or Version 8 file may never be seen. The following are examples of specifying an engine:

libname v7lib v7 'SAS-data-library'; 
libname v8lib v8 'SAS-data-library';
libname v6lib v6 'SAS-data-library';

In this example, the libref V7LIB accesses only Version 7 files or Version 8 files, the libref V8LIB accesses only Version 8 files or Version 7 files, and the libref V6LIB accesses only Version 6 files.

The file extension can be used to determine which version of SAS software was used to create the file. Version 6 and Version 7 or Version 8 Data File Extensions for a Windows 95 Host shows examples of Version 6 and Version 7 or Version 8 filename extensions for a Windows 95 host:

Version 6 and Version 7 or Version 8 Data File Extensions for a Windows 95 Host
File Type V6 Filename

Extension

V7 or V8 Filename

Extension

Data File sd2 sas7bdat
Catalog sc2 sas7bcat
View sv2 sas7bvew


Concatenating Libraries

In order to expand the scope of file access from a single library to multiple libraries, use library concatenation. With an expanded scope, you can perform operations on either Version 6 files or Version 7 or Version 8 files that span multiple libraries.

Here is an example of library concatenation:

libname v6lib v6 'SAS-data-library';
libname v8lib v8 'SAS-data-library';
libname catlib (v8lib v6lib);

Note:   SAS-data-library must be the physical name that is recognized by the operating environment.  [cautionend]

The first LIBNAME statement assigns the libref V6LIB to a SAS data library that is accessed with the V6 remote engine. The V6 remote engine recognizes only files that are appended with a Version 6 filename extension.

The second LIBNAME statement assigns the libref V8LIB to a SAS data library that is accessed with the V8 remote engine. The V8 remote engine recognizes only files that are appended with a Version 7 or Version 8 filename extension.

The third LIBNAME statement assigns the libref CATLIB to concatenated libraries that are referenced by the librefs V8LIB and V6LIB. The order of the librefs identifies the sequence in which the libraries are searched. The SAS operation uses the first occurrence of a specified file.

For example, if the same file exists in both libraries and you delete that file, then the file in the first library (for example, STOCK.SAS7BDAT in V8LIB) is deleted. If V6LIB precedes V8LIB in the library concatenation (for example, STOCK.SD2 in V6LIB), then that file is deleted. If the specified file exists in only one library, then that file is deleted.


Chapter Contents

Previous

Next

Top of Page

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