Previous Page | Next Page

XPORT Engine with DATA Step or PROC COPY

Restoring Transport Files at the Target Computer


Identifying the Content of the Transport File

If the person who restores the transport file at the target operating environment is different from the person who creates the transport file at the source operating environment, make sure you obtain information about the transport file in advance of the file restore operation. Here is an example of the type of information that might be useful for restoring the transport file to native format at the target operating environment:

Description of Transport File
Type of Source Operating Environment and SAS Release Used Strategy Used to Create Transport File Transport Filename Data Sets
z/OS

SAS 9

XPORT Engine TPORT.DAT TEST.CITY

TEST.CLASS

You can find out which strategy was used to create the transport file by examining the file header. The XPORT engine and PROC CPORT create transport files whose headers look different. For details, see File Headers: Finding Out the Method Used to Create the Transport File.

Also, you can use PROC CONTENTS and PROC DATASETS to list the contents of the transport file. For details about these procedures, see Base SAS Procedures Guide.


Example: Using a DATA Step to Restore a Single Data Set from a Transport File

This example uses the DATA step to restore a data set from a transport file.

libname xportin xport 'transport-file';
libname target 'SAS-data-library';
data target.grades;
   set xportin.grades;
run;

In the preceding example, the libref XPORTIN points to the location of the exported data set that was transferred to the target operating environment. The XPORT engine specifies that the data set is to be read in transport format. The libref TARGET points to a new location where the translated file will be copied. The SET statement reads the data set XPORTIN.GRADES in transport format and translates it and copies it to the location specified in the DATA statement. Because a DATA step with the XPORT engine was used at the source operating environment to create the transport file for a single data set, only a data set can be restored at the target operating environment.


Example: Using PROC COPY to Restore Data Sets from a Transport File

This example uses the COPY procedure to restore one or more data sets from a transport file.

libname xportin xport 'transport-file';
libname target 'SAS-data-library';
proc copy in=xportin out=target;
  select grades;
run;

In the preceding example, the libref XPORTIN points to the location where the transport file was transferred to the target operating environment. The XPORT engine in this LIBNAME statement specifies that the transport file at this location is to be read in transport format. The libref TARGET points to a new location where the transport file will be copied in native format. The PROC COPY statement copies the selected data set GRADES from the library that is identified in the IN= option to the new library that is identified in the OUT= option.

Using a SELECT statement, you specify one or more specific data sets to be copied to the new library. To specify that all data sets in the transport file be copied, omit the SELECT statement from PROC COPY.

Note:   You can use the EXCLUDE statement in PROC COPY to omit explicitly the data sets that you do not want instead of using the SELECT statement to specify the data sets that you want.  [cautionend]

Previous Page | Next Page | Top of Page