SAS Institute. The Power to Know

FOCUS AREAS

Hot Topics

Related Links

SAS®9 Compatibility

Migration

Using a SAS®9 Data File under a Previous Version of SAS


Introduction

SAS®9 users can share SAS files with users of prior releases, but the methods differ according to the circumstances. In some cases, the processing is transparent, and the file can be used as-is with no extra steps. This is an example of compatibility. If compatibility does not meet your needs, you might be able to change the file to the format of the previous version, which is known as regressing. This document provides information about compatibility as well as instructions, limitations, and requirements for several methods of regressing.

In addition to the methods presented here, if you have SAS/CONNECT or SAS/SHARE licensed, you can always use Remote Library Services in SAS/CONNECT or SAS/SHARE, or Data Transfer Services (DTS) in SAS/CONNECT.

Note

Do not use PROC CPORT and PROC CIMPORT for regressing. You will experience numerous errors trying to import the transport file. Common errors include the following:

     ERROR: TRANSPORT FILE IS BAD
     ERROR: The value is not a valid SAS name

While the CPORT transport file enables SAS users to share SAS data files between operating environments, it was designed to support the newest features of SAS. As such, it renders the data unusable to prior releases. For more information, see the topic about using PROC CPORT and PROC CIMPORT in Moving and Accessing SAS Files in the SAS online documentation.


Using a SAS®9 Data File under SAS 7 or 8

Because compatibility requires no extra steps, it's usually preferred to regressing. Read the next few sections and determine whether compatibility meets your needs.

First Try Compatibility in SAS 7 or 8

If you share a SAS data file on the same operating environment, you probably have all the compatibility you need. In this case, the file is called native (see the following section for more information). If you share the file between different operating environments, SAS processes the file with cross environment data access (CEDA), which requires no extra steps on your part, but does introduce a few limitations. This type of file is called foreign.

Native Files in SAS 7 or 8

A SAS®9 file has the same file format and the same extension (for example, SAS7BDAT) as a SAS 7 or 8 file. For native files, the available processing is very good: Native SAS®9 data files1 are fully compatible in a SAS 7 or 8 session as long as you don't use any new SAS®9 file features that aren't supported under SAS 7 or 8. In addition, changing to a different character encoding makes a file foreign, but this generally occurs only when you share files with speakers of another language.

The following table shows the operating environments where SAS®9 data files are native in a SAS 7 or 8 session.

Native SAS®9 Data Files1 in SAS 7 or 8
SAS®9 Environment SAS 7 or 8 Environment
64-bit AIX
64-bit HP-UX
64-bit Solaris SPARC
64-bit AIX
64-bit HP-UX
64-bit Solaris SPARC
z/OS z/OS (any OS/390)
Solaris for x64
Linux for x64
Tru64 UNIX2
Tru64 UNIX
Linux for Itanium-based systems
Tru64 UNIX
Linux for 32-bit Intel architecture Linux for 32-bit Intel architecture
Intel ABI
OpenVMS Alpha OpenVMS Alpha
32-bit Windows 32-bit Windows

1 For supported processing of other SAS file types (data view, catalog, and so forth), see the "Native File" column of the table Processing Version 7 and 8 SAS Files in SAS®9, including the footnotes.

2 Data sets are native (CEDA is not invoked), but catalogs from Solaris for x64 are not supported on Tru64 UNIX.

Foreign Files in SAS 7 or 8

The table in the previous section summarizes the operating environments where a SAS®9 data file is native in SAS 7 or 8. If your circumstances are not listed, then the file is foreign and SAS processes it under Cross Environment Data Access (CEDA).

With CEDA, you can read a SAS®9 file under SAS 7, SAS 8, or any interim release of SAS®9, even on a different operating environment. You can transfer your data files as binary files from one operating environment to another, or NFS-mount a disk from another environment, and automatically access your data without any extra steps.

For a summary of supported file types, see the "Foreign File" column of the table Processing Version 7 and 8 SAS Files in SAS®9, including the footnotes. For full details, see the CEDA topic. Those topics discuss SAS®9 processing of a SAS 7 and 8 file, but the information applies to the current situation as well. Because the processing of a SAS data set by CEDA is transparent to you, in order to determine whether CEDA is being invoked, set the system option MSGLEVEL=i before you run any procedure against the data set. You can also use PROC CONTENTS in SAS®9 and look in the output under the field DATA REPRESENTATION; if it's not the current session's operating environment, CEDA is in use. Note that the file cannot use any new SAS®9 file features that aren't supported under SAS 7 or 8.

The CEDA topic mentions a few important restrictions. If those restrictions are unacceptable, see the regressing methods in the following sections.

Regressing to SAS 7 or 8

You cannot simply use the V8 engine for regressing of SAS®9 files. Nor can you use PROC CPORT and PROC CIMPORT for SAS data files (SAS catalogs have no known issues). Keep in mind that the SAS 7 or 8 file must adhere to SAS 7 or 8 capabilities. The following table summarizes supported methods and their limitations.

Methods of Regressing a SAS®9 File to SAS 7 or 8
Method Limitations
PROC COPY with the NOCLONE option Must be run in the SAS 7 or 8 session
DATA step Must be run in the SAS 7 or 8 session
XPORT engine Truncates variable names to eight characters
OUTREP=  

Using PROC COPY and NOCLONE for Regressing to SAS 7 or 8

In a SAS 7 or 8 session, you can use PROC COPY with the NOCLONE option to copy a foreign file to a native SAS data file. Here is some example code.

   libname intest 'pathname-of-foreign-file';
   libname outtest 'pathname-for-new-native-file';
   proc copy in=intest out=outtest noclone;
      /* Use the SELECT statement to specify a single data set */
      select my-data-set;
   run;

Using the DATA Step for Regressing to SAS 7 or 8

In a SAS 7 or 8 session, if you submit a DATA step like the following example, the new data set is created in the native data representation of the current operating environment:

   libname intest 'pathname-of-foreign-file';
   libname outtest 'pathname-for-new-native-file';
   data outtest.native-filename;
      set intest.foreign-filename;
   run;

Using the XPORT Engine for Regressing to SAS 7 or 8

The XPORT engine enables portability across operating environments and between versions. You can create a transport file in a SAS®9 session and restore it in a SAS 6, 7, or 8 session.

The XPORT engine supports some Version 5 naming restrictions: variable names with 8 characters or fewer and labels with up to 40 characters. If your data file does not conform to these specifications, then you must specify the system option VALIDVARNAME=V6, which truncates the names and labels according to the algorithm documented in Moving and Accessing SAS Files. See that documentation for full syntax and usage.

   options validvarname=v6

Here is an example of code you run in the SAS®9 session:

   libname source 'pathname-of-v9-file';

   /* Give the transport file a name and extension */
   /* In this case, the transport file is c:\mySAS\filename.stx */

   libname xportout xport 'c:\mySAS\filename.stx';
   proc copy in=source out=xportout;
     /* Use the SELECT statement to specify a single data set */
     select my-data-set;
   run;

And this is an example of code you run in the SAS 7 or 8 session:

   libname xportin xport 'c:\mySAS\filename.stx';
   libname target 'pathname-for-v8-file';
   proc copy in=xportin out=target;
   run;

Do not use the DATECOPY option with PROC COPY in this method; see SAS Note 13224.

Using the OUTREP= Option for Regressing to SAS 7 or 8

If you want to avoid a performance loss from CEDA processing and cannot use the XPORT engine due to its variable truncation, here is another alternative. You can create the file in SAS®9 with the desired SAS 8 native data representation. The new OUTREP= data set and LIBNAME option creates a SAS data set with the data representation of another operating environment.

Here are the OUTREP= values that you can specify in a DATA step or LIBNAME statement:


Regressing a SAS®9 Data File to SAS 6

SAS®9 data files cannot be used in SAS 6 without regressing to SAS 6 format.

Use the table below to determine which method to use. Keep in mind that the SAS 6 file must adhere to SAS 6 capabilities; a few SAS®9 file features are not supported under SAS 6.

Methods of Regressing a SAS®9 File to SAS 6
Method Limitations
DATA step with the V6 engine SAS®9 and SAS 6 must be on the same operating environment.
PROC COPY with the V6 engine Set VALIDVARNAME=V6 before the PROC COPY.
SAS®9 and SAS 6 must be on the same operating environment.
XPORT engine  

In addition, if SAS/CONNECT is licensed, you can use PROC UPLOAD and PROC DOWNLOAD to regress a file.

Using the DATA Step with the V6 Engine for Regressing to SAS 6

Here is an example of regressing an existing SAS®9 file to Version 6 by using the V6 engine. SAS®9 and SAS 6 must be on the same operating environment. In other words, you can only create a SAS 6 file for the platform you are running SAS®9 on. The two operating environments must both be 32-bit or both be 64-bit.

   libname v9lib 'pathname-of-v9-file';
   libname v6lib v6 'pathname-for-v6-file';
   data v6lib.v6-filename;
      set v9lib.v9-filename;
   run;

Using PROC COPY with the V6 Engine for Regressing to SAS 6

Here is an example of regressing using PROC COPY. SAS®9 and SAS 6 must be on the same operating environment. In other words, you can only create a SAS 6 file for the operating environment you are running SAS®9 on. The two platforms must both be 32-bit or both be 64-bit.

By default, the V6 engine automatically uses VALIDFMTNAME=FAIL processing, which produces an error message if you use a format or informat name longer than eight characters.

   libname v9lib v9 'pathname-of-v9-file';
   libname v6lib v6 'pathname-of-v6-file';

   options validvarname=v6;

   proc copy in=v9lib out=v6lib;
      /* Use the SELECT statement to specify a single data set */
      select my-data-set;
   run;

Using the XPORT Engine for Regressing to SAS 6

The XPORT engine enables portability across operating environments and between versions. See the information above in the section about using XPORT for regressing to SAS 7 or 8.


Further Reading in the SAS Online Documentation