Previous Page | Next Page

The CIMPORT Procedure

CIMPORT Problems: Importing Transport Files


About Transport Files and Encodings

The character data in a transport file is created in either of two types of encodings:

These examples show how SAS applies an encoding to a transport file:

Assignment of Encodings to Transport Files
Encoding Value of the Transport File Example of Applying an Encoding in a SAS Invocation Explanation
UTF-8 sas9 -encoding utf8; A SAS session is invoked using the UTF-8 encoding. The session encoding is applied to the transport file .
wlatin2 sas9 -locale pl_PL; A SAS session is invoked using the default UNIX encoding, latin2, which is associated with the Polish Poland locale.

For a complete list of encodings that are associated with each locale, see the Locale Table in SAS National Language Support (NLS): Reference Guide.

The encodings of the source and target SAS sessions must be compatible in order for a transport file to be imported successfully.. Here is an example of compatible source and target SAS sessions:

Compatible Encodings
Source SAS Session
Target SAS Session
Locale UNIX SAS Session Encoding Transport File Encoding Locale Windows SAS Session Encoding
es_MX (Spanish Mexico) latin1 wlatin1 it_IT

(Italian Italy)

wlatin1

The encodings of the source and target SAS sessions are compatible because the Windows default encoding for the es_MX locale is wlatin1 and the encoding of the target SAS session is wlatin1.

However, if the encodings of the source and target SAS sessions are incompatible, a transport file cannot be successfully imported. Here is an example of incompatible encodings:

Incompatible Encodings
Source SAS Session
Target SAS Session
Locale UNIX SAS Session Encoding Transport File Encoding Locale z/OS Encoding
cs_CZ (Czech Czechoslovakia) latin2 wlatin2 de_DE (German Germany) open_ed-1141

The encodings of the source and target SAS sessions are incompatible because the Windows default encoding for the cs_CZ locale is wlatin2 and the encoding of the target SAS session is open_ed-1141. A transport file cannot be imported between these locales.

When importing transport files, you will be alerted to compatibility problems via warnings and error messages.


Problems with Transport Files Created Using a SAS Release Before 9.2


Overview: SAS Releases Before 9.2

Transport files that were created by SAS releases before 9.2 are not stamped with encoding values. Therefore, the CIMPORT procedure does not know the identity of the transport file's encoding and cannot report specific warning and error detail. The encoding of the transport file must be inferred when performing recovery actions.

However, using your knowledge about the transport file, you should be able to recover from transport problems. For information that is useful for importing the transport file in the target SAS session, see Transport File Tips. For complete details about creating and restoring transport files, see Moving and Accessing SAS Files.

Here are the warning and error messages with recovery actions:


Error: Transport File Encoding Is Unknown: Use the ISFILEUTF8= Option

The error message provides this information:

Note:   In order to perform recovery steps, you must know the encoding of the transport file.  [cautionend]

If you know that the transport file is encoded as UTF-8, you can import the file again, and use the ISFILEUTF8=YES option in PROC CIMPORT.

Example: UTF-8 transport file, which was created using a SAS release before 9.2, and UTF-8 target SAS session

filename importin 'transport-file';
libname target 'SAS-data-library';
proc cimport isfileutf8=yes infile=importin library=target memtype=data;
run;

For syntax details, see the ISFILEUTF8= Option in PROC CIMPORT.

PROC CIMPORT should succeed.


Warning: Transport File Encoding Is Unknown

The warning message provides this information:

Try to read the character data from the imported data set. If you cannot read the data, you can infer that the locale of the target SAS session is incompatible with the encoding of the transport file.

Note:   In order to perform recovery steps, you must know the encoding of the transport file.  [cautionend]

Example: The transport file, which was created using a Polish Poland locale, was created in a source SAS session using a SAS release before 9.2. The target SAS session uses a German locale.

  1. In the target SAS session, start another SAS session and change the locale to the locale of the source SAS session that created the transport file.

    In this example, you start a new SAS session in the Polish Poland locale.

    sas9 -locale pl_PL;

  2. Import the file again. Here is an example:

    filename importin 'transport-file';
    libname target 'SAS-data-library';
    proc cimport infile=importin library=target memtype=data;
    run;

PROC CIMPORT should succeed and the data should be readable in the SAS session that uses a Polish_Poland locale.


Problems with Transport Files Created Using SAS 9.2


Overview of SAS 9.2

The encoding of the character data is stamped in transport files that are created using SAS 9.2. Therefore, the CIMPORT procedure can detect error conditions such as UTF8-encoded transport files cannot be imported into SAS sessions that do not use the UTF-8 encoding. For example, a UTF-8 transport file cannot be imported into a SAS session that uses the Wlatin2 encoding.

Also, SAS 9.2 can detect the condition of incompatibility between the encoding of the transport file and the locale of the target SAS session. Because some customers' SAS applications ran successfully using a release before SAS 9.2, PROC CIMPORT will report a warning only, but will allow the import procedure to continue.

Here are the warning and error messages with recovery actions:


Error: Target Session Uses UTF-8: Transport File Is not UTF-8

The error message provides this information:

The encoding of the target SAS session cannot be UTF-8. Also, the locales of the source and target SAS sessions must be identical.

Example: SAS 9.2 Wlatin2 transport file and UTF-8 target SAS session:

  1. To recover, in the target SAS session, start another SAS session and change the locale to the locale that was used in the source SAS session that created the transport file.

    The LOCALE= value is preferred over the ENCODING= value because it sets automatically the default values for the ENCODING=, DFLANG=, DATESTYLE= and PAPERSIZE= options.

    If you do not know the locale of the source session (or the transport file), you can infer it from the national language that is used by the character data in the transport file.

    For example, if you know that Polish is the national language, specify the pl_PL (Polish Poland) locale in a new target SAS session. Here are the encoding values that are associated with the pl_PL locale:

    LOCALE= Value for the Polish Language
    Posix Locale Windows Encoding UNIX Encoding z/OS Encoding
    pl_PL

    (Polish Poland)

    wlatin2 latin2 open_ed-870

    Here is an example of specifying the pl_PL locale in a new SAS session:

    sas9 -locale pl_PL;

    For complete details, see the Locale Table in SAS National Language Support (NLS): Reference Guide.

    Note:   Verify that you do not have a SAS invocation command that already contains the specification of the UTF-8 encoding; for example, sas9 -encoding utf8;. If it exists, the UTF-8 encoding would persist regardless of a new locale specification.   [cautionend]

  2. Import the file again. Here is an example:

    filename importin 'transport-file';
    libname target 'SAS-data-library';
    proc cimport infile=importin library=target memtype=data;
    run;

    PROC CIMPORT should succeed.


Error: Target Session Does Not Use UTF-8: Transport File Is UTF-8

The error message provides this information:

The encoding of the target SAS session must be changed to UTF-8.

Example: SAS 9.2 UTF-8 transport file and Wlatin1 target SAS session:

  1. To recover, in the target SAS session, start a new SAS session and change the session encoding to UTF-8. Here is an example:

    sas9 -encoding utf8;

  2. Import the file again. Here is an example:

    filename importin 'transport-file';
    libname target 'SAS-data-library';
    proc cimport infile=importin library=target memtype=data;
    run;

PROC CIMPORT should succeed.

Warning: Target Session Does Not Use UTF-8: Transport File Is Not UTF-8

The warning message provides this information:

Example: Wlatin2 transport file and open_ed-1141 target SAS session

This table shows the locale and encoding values of incompatible source and target SAS sessions. Although the wlatin2 Windows encoding that is assigned to the transport file in the source SAS session is incompatible with the open_ed-1141 encoding of the target SAS session, a warning is displayed and the import will continue.

Encoding Values for the Czech and German Locales
SAS Session Posix Locale Windows Encoding UNIX Encoding z/OS Encoding
Source SAS Session cs_CZ (Czech Czechoslovakia) wlatin2 latin2 open_ed-870
Target SAS Session de_DE (German Germany) wlatin1 latin9 open_ed-1141

The transport file is imported, but the contents of the file are questionable. The message identifies the incompatible encoding formats. To recover, try to read the contents of the imported file. If the file is unreadable, perform these steps:

  1. In the target SAS session, start a new SAS session and change the locale (rather than the encoding) to the locale that is used in the source SAS session.

    The LOCALE= value is preferred over the ENCODING= value because it automatically sets the default values for the ENCODING=, DFLANG=, DATESTYLE= and PAPERSIZE= options.

    If you do not know the locale of the source session (or the transport file), you can infer it from the national language of the transport file.

    For example, if you know that Czech is the national language, specify the cs_CZ locale in a new target SAS session.

    Here is an example of specifying the cs_CZ locale in a new SAS session:

    sas9 -locale cs_CZ;

    The target SAS session and the transport file use compatible encodings. They both use wlatin2.

    For complete details, see the Locale Table in SAS National Language Support (NLS): Reference Guide.

  2. Import the file again. Here is an example:

    filename importin 'transport-file';
    libname target 'SAS-data-library';
    proc cimport infile=importin library=target memtype=data;
    run;

    PROC CIMPORT should succeed.

Previous Page | Next Page | Top of Page