Creating a Transport File at the Source Computer

Create a transport file that contains one or more SAS data sets or one or more SAS catalogs by using PROC CPORT.

Create a Transport File Using PROC CPORT

Example: Using PROC CPORT to Create a Transport File for Data Sets

This example uses the CPORT procedure to create a transport file for one data set.
libname source 'SAS-data-library';
filename cportout 'transport-file';
proc cport data=source.grades file=cportout;
run;
In the preceding example, the libref SOURCE points to the original location of the data set that is on the source computer. The fileref CPORTOUT points to a new location where the transport file will be created. The PROC CPORT statement copies, as its source, the file that is identified in the DATA= option to the new transport file that is identified in the FILE= option. The DATA= option specifies only one data set to be transported.
To include the entire contents of a library, which can contain multiple catalogs and data sets, specify the LIBRARY= option instead of the DATA= option in PROC CPORT.
Here is an example of PROC CPORT that specifies that all data sets in the library be transported:
proc cport library=source file=cportout memtype=data;

Example: Using PROC CPORT to Create a Transport File for Multiple Catalogs

This example uses the CPORT procedure to create a transport file for multiple catalogs in a library.
libname source 'SAS-data-library';
filename cportout 'transport-file';
proc cport library=source file=cportout memtype=catalog;
run;
In the preceding example, the libref SOURCE points to the library that contains the catalogs that are on the source computer. The fileref CPORTOUT points to a new location where the transport file will be created. The PROC CPORT statement copies from the specified library all members of the types that are identified in the MEMTYPE= option to the new transport file that is identified in the FILE= option.
You can use the EXCLUDE statement in PROC CPORT to omit explicitly the catalog entries that you do not want. Another option is to use the SELECT statement in PROC CPORT to specify the catalog entries that you want.

Example: Using PROC CPORT to Create a Transport File for an Entire Catalog

This example uses the CPORT procedure to create a transport file for an entire catalog.
libname source 'SAS-data-library';
filename cportout 'transport-file';
proc cport catalog=source.testcat file=cportout;
run;
In the preceding example, the libref SOURCE points to the original location of the catalog that is on the source computer. The fileref CPORTOUT points to a new location where the transport file will be created. The PROC CPORT statement copies, as its source, the file that is identified in the CATALOG= option to the new transport file that is identified in the FILE= option. SOURCE specifies the libref and TESTCAT specifies the catalog name. The omission of the SELECT or EXCLUDE statements in PROC CPORT indicates that the entire catalog should be copied.

Example: Using PROC CPORT to Create a Transport File for a Specific Catalog Entry Type

This example uses the CPORT procedure to create a transport file for a specific catalog entry type:
libname source 'SAS-data-library';
filename cportout 'transport-file';
proc cport catalog=source.testcat file=cportout et=list;
run;
In the preceding example, the libref SOURCE points to the original location of the catalog that is on the source computer. The fileref CPORTOUT points to a new location where the transport file will be created. The PROC CPORT statement copies, as its source, the file that is identified in the CATALOG= option to the new transport file that is identified in the FILE= option. The ET= option in PROC CPORT specifies that all catalog entries of type LIST be written to the new library. Alternatively, you can use the EET= option to exclude an entire entry type.

Example: Using PROC CPORT to Create a Transport File for Catalog Entries

This example uses the CPORT procedure to create a transport file for one or more catalog entries:
libname source 'SAS-data-library';
filename cportout 'transport-file';
proc cport catalog=source.mycat file=cportout; 
  select testnpgm.list;
run;
In the preceding example, the libref SOURCE points to the original location of the catalog that is on the source computer. The fileref CPORTOUT points to a new location where the transport file will be created. The PROC CPORT statement copies as its source the file that is identified in the CATALOG= option to the new transport file that is identified in the FILE= option.
In this example, SELECT TESTNPGM.LIST explicitly names a single catalog entry. However, you can specify one or more catalog entries by name.
You can use the EXCLUDE statement in PROC CPORT to omit explicitly the catalog entries that you do not want. Alternatively, you can use the SELECT statement in PROC CPORT to specify catalog entries that you want.