Creating a Transport File at the Source Computer

Example: Using the DATA Step to Create a Transport File for One Data Set

This example uses the DATA step to create a transport file for one data set.
libname source 'SAS-data-library';
libname xportout xport 'transport-file';
data xportout.grades;
   set source.grades;
run;
In the preceding example, the libref SOURCE points to the original location of the data set that is on the source operating environment. The libref XPORTOUT points to a new location where the transport file will be created. The XPORT engine in this LIBNAME statement specifies that the data set is to be created in transport format. The SET statement reads the data set GRADES and re-creates it in transport format at the location specified in the DATA statement.

Example: Using PROC COPY to Create a Transport File for One or More Data Sets

This example uses the COPY procedure to create a transport file for multiple data sets.
libname source 'SAS-data-library';
libname xportout xport 'transport-file';
proc copy in=source out=xportout memtype=data; 
run;
In the preceding example, the libref SOURCE points to the original location of the library that is on the source operating environment. The libref XPORTOUT points to a new location to which the transport file will be copied. The XPORT engine in this LIBNAME statement specifies that the library is to be created in transport format. The PROC COPY statement copies all data sets in the library that are identified in the IN= option to the new library that is identified in the OUT= option. The MEMTYPE=DATA option limits the files that are copied to type DATA, which excludes catalogs and views.
CAUTION:
Do not omit the MEMTYPE=DATA option.
Otherwise, SAS attempts to copy the entire contents of the library (including catalogs and views) to the transport file. The XPORT engine does not support the CATALOG or the VIEW member type. Error and warning messages are written to the SAS log.
This example uses PROC COPY to create a transport file for one data set:
libname source 'SAS-data-library';
libname xportout xport 'transport-file';
proc copy in=source out=xportout memtype=data; 
   select grades;
run;
In the preceding example, the libref SOURCE points to the original location of the data set that is on the source operating environment. The libref XPORTOUT points to a new location where the transport file will be copied. The XPORT engine in this LIBNAME statement specifies that the data set is to be created in transport format. The PROC COPY statement copies all data sets that are identified in the IN= option to the new library that is identified in the OUT= option. The MEMTYPE=DATA option limits the files that are copied to type DATA, which excludes catalogs and views. The SELECT statement specifies that only the data set GRADES be copied to the new library. However, you could specify more than one data set here. If you omit the SELECT statement, all data sets will be copied to the transport file.
Note: You can use the EXCLUDE statement 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.