FOCUS AREAS

Hot Topics

Related Links

Compatibility

Migration

Best Practices for Compatibility

These coding practices and example code can facilitate compatibility.

Helpful Language Elements

The following coding practices maximize your control over cross-release compatibility.

EXTENDOBSCOUNTER=
In SAS 9.4, extended observation count is the default. In SAS 9.3 it is optional. If a data set has EXTENDOBSCOUNTER=YES, then it is not accessible by any release prior to SAS 9.3. Set the system option EXTENDOBSCOUNTER=NO for compatibility with releases prior to SAS 9.3. For details, see the topics about observation count in SAS Language Reference: Concepts.

VALIDMEMNAME=
In SAS 9.3 and later, naming rules are extended for more functionality in SAS data set names, view names, and item store names. If you need to enforce behavior that is compatible with previous releases, set the system option VALIDMEMNAME=COMPATIBLE. Messages are printed in the log when names cannot be transcoded. For details, see the chapter about rules for SAS data set names, view names, and item store names in SAS Language Reference: Concepts.

Encoding language elements
override the session encoding. Understanding encoding can be important when you exchange data with others. When you use PROC MIGRATE, a migrated data set takes on the data representation and encoding attributes of the target library. See the SAS NLS (National Language Support) User's Guide for information about encoding and transcoding.

OUTREP=
PROC MIGRATE can use the LIBNAME option OUTREP= for DATA, VIEW, ACCESS, MDDB, and DMDB member types. If you specify the OUTREP= option, you might also want to specify the EXTENDOBSCOUNTER= option. These options are appropriate in the LIBNAME statement for the OUT= library. See SAS Statements: Reference.

MSGLEVEL=
Setting the system option MSGLEVEL=I generates a log note with useful information about index usage, merge processing, and sort utilities, along with standard notes, warnings, and error messages. You might want to know, for example, whether a file is being processed with CEDA. Beginning with SAS 9.1.3 Service Pack 4, you get this behavior even if you do not specify MSGLEVEL=I.

VALIDVARNAME=
Setting the system option VALIDVARNAME=V6 truncates long variable names for compatibility with SAS 6. Similarly, VALIDVARNAME=V7 forces appropriate naming behavior for SAS 7 and later.

VALIDFMTNAME=
Setting the system option VALIDFMTNAME=FAIL causes an error message when a long format or informat name is used, which is useful for compatibility with SAS 6. If a long format name is used in SAS 6, processing fails.

V6CREATEUPDATE=
The V6CREATEUPDATE= system option controls and monitors the behavior of SAS when an attempt is made to create or update a SAS 6 data set.

Determining Data Representation and Encoding

SAS performs best when accessing files that have compatible data representation and character encoding with the current session. If you work with files created under incompatible operating environments, then you need a way to quickly learn the data representation and character encoding of a data set and compare it to those of the current session.

Interpreting PROC CONTENTS Output for a Version 7 or Later SAS File

The CONTENTS procedure writes out information about data file attributes of Version 7 and later files. In the CONTENTS output, "Data Representation" lists the environments on which the file can be accessed without cross-environment data access (CEDA) processing limitations. The value includes _32 or _64 to designate 32-bit or 64-bit architecture. The "Encoding" attribute lists the file's character encoding (see SAS National Language Support (NLS): User's Guide in the online documentation).

In the following example, the data representation values are all 64-bit UNIX operating environments. The encoding is latin1. In this example, if you are currently running SAS on any of the listed UNIX operating environments under latin1 session encoding, then you are dealing with a compatible data file and you have full processing capabilities. If this is the case, then you do not need to migrate this file to the newer SAS file format unless you want to use one of the new SAS file features. If, however, you determine that the file is incompatible, then you must determine whether CEDA processing is sufficient for your needs.

                                  The SAS System                                1

                               The CONTENTS Procedure

Data Set Name       HEALTH.OXYGEN                          Observations         31
Member Type         DATA                                   Variables            7
Engine              V9                                     Indexes              0
Created             Wednesday, May 07, 2003 10:03:30       Observation Length   56
Last Modified       Wednesday, May 07, 2003 10:03:30       Deleted Observations 0
Protection                                                 Compressed           NO
Data Set Type                                              Sorted               NO
Label
Data Representation HP_UX_64, RS_6000_AIX_64, SOLARIS_64, HP_IA64
Encoding            latin1  Western ( ISO )

Using PROC CONTENTS for a Version 7 or Later SAS File

In a SAS session, PROC CONTENTS together with the ODS OUTPUT statement and ATTRIBUTES= can write out the data representation and encoding values. Run the code first for the current session and then for existing files.

  1. Submit the following code in the target SAS session:
       data check_session;x=1;
       run;
    
       ods output attributes=atr1(keep=label1 cvalue1
           where=(label1 in ('Data Representation', 'Encoding')));
       ods listing close;
       proc contents data=check_session;
       run;
    
       ods listing;
       proc print data=atr1;
       run;
    
    And you get handy output that makes the current session's data representation and encoding values easy to see:
       Obs    Label1                 cValue1
    
        1     Data Representation    MVS_32
        2     Encoding               open_ed-1047  Western (OpenEdition)
    
  2. Now, to output the data representation and encoding values of an existing data set, omit the DATA step. On the PROC CONTENTS statement, replace CHECK_SESSION with the data set's name.

Using PROC CONTENTS for a Version 6 SAS File

For a Version 6 file, the data representation and encoding values are always returned as DEFAULT, so you cannot use the same method as you would for a Version 7 or 8 file. Instead use example code like the following (which works for Version 6, 7, and 8 files) to write out the value of the "Host Created" attribute. Run the code first for the current session and then for existing files.

  1. Submit the following code in a SAS session. This code is supported in all operating environments except z/OS.
       data test;x=1;run;
    
       ods output EngineHost=eng(keep=label1 cvalue1
           where=(label1='Host Created'));
       ods listing close;
       proc contents data=test;run;
       ods listing;
    
       proc print data=eng;run;
    
    The code creates a simple test data set and then writes out its Host Created value for the current session. The example output says the file was created under SunOS:
       Obs       Label1       cValue1
         1     Host Created    SunOS
    
  2. To output the Host Created of an existing data set, omit the DATA step. On the PROC CONTENTS statement, replace TEST with the data set's name.