Procedure features:
PROC CPORT statement options:
FILE=
MEMTYPE=
This example shows how to use PROC CPORT to export entries from all of the SAS catalogs in the SAS data library you specify.
Specify the library reference for the SAS data library that contains the source files to be exported and the file reference to which the output transport file is written. The LIBNAME statement assigns a libref for the SAS data library. The FILENAME statement assigns a fileref and any operating environment options for file characteristics for the transport file that PROC CPORT creates.
libname source ' SAS-data-library '; filename tranfile ' transport-file ' host-option(s)-for-file-characteristics ;
Create the transport file. The PROC CPORT step executes on the operating environment where the source library is located. MEMTYPE=CATALOG writes all SAS catalogs in the source library to the transport file.
proc cport library=source file=tranfile memtype=catalog; run;
NOTE: Proc CPORT begins to transport catalog SOURCE.FINANCE NOTE: The catalog has 5 entries and its maximum logical record length is 866. NOTE: Entry LOAN.FRAME has been transported. NOTE: Entry LOAN.HELP has been transported. NOTE: Entry LOAN.KEYS has been transported. NOTE: Entry LOAN.PMENU has been transported. NOTE: Entry LOAN.SCL has been transported. NOTE: Proc CPORT begins to transport catalog SOURCE.FORMATS NOTE: The catalog has 2 entries and its maximum logical record length is 104. NOTE: Entry REVENUE.FORMAT has been transported. NOTE: Entry DEPT.FORMATC has been transported.
Procedure features:
PROC CPORT statement options:
FILE=
SELECT statement
This example shows how to use PROC CPORT to export individual catalog entries, rather than all of the entries in a catalog.
Assign library references. The LIBNAME and FILENAME statements assign a libref for the source library and a fileref for the transport file, respectively.
libname source ' SAS-data-library '; filename tranfile ' transport-file ' host-option(s)-for-file-characteristics ;
Write an entry to the transport file. SELECT writes only the LOAN.SCL entry to the transport file for export.
proc cport catalog=source.finance file=tranfile; select loan.scl; run;
NOTE: Proc CPORT begins to transport catalog SOURCE.FINANCE NOTE: The catalog has 5 entries and its maximum logical record length is 866. NOTE: Entry LOAN.SCL has been transported.
Procedure features:
PROC CPORT statement option:
FILE=
This example shows how to use PROC CPORT to export a single SAS data set.
Assign library references. The LIBNAME and FILENAME statements assign a libref for the source library and a fileref for the transport file, respectively.
libname source SAS-data-library' ; filename tranfile ' transport-file ' host-option(s)-for-file-characteristics ;
Specify the type of file that you are exporting. The DATA= specification in the PROC CPORT statement tells the procedure that you are exporting a SAS data set rather than a library or a catalog.
proc cport data=source.times file=tranfile; run;
NOTE: Proc CPORT begins to transport data set SOURCE.TIMES NOTE: The data set contains 2 variables and 2 observations. Logical record length is 16. NOTE: Transporting data set index information.
Procedure features:
PROC CPORT statement option:
FILE=
TRANTAB statement option:
TYPE=
This example shows how to apply a customized translation table to the transport file before PROC CPORT exports it. For this example, assume that you have already created a customized translation table called TTABLE1.
Assign library references. The LIBNAME and FILENAME statements assign a libref for the source library and a fileref for the transport file, respectively.
libname source SAS-data-library' ; filename tranfile ' transport-file ' host-option(s)-for-file-characteristics ;
Apply the translation specifics. The TRANTAB statement applies the translation that you specify with the customized translation table TTABLE1. TYPE= limits the translation to FORMAT entries.
proc cport catalog=source.formats file=tranfile; trantab name=ttable1 type=(format); run;
NOTE: Proc CPORT begins to transport catalog SOURCE.FORMATS NOTE: The catalog has 2 entries and its maximum logical record length is 104. NOTE: Entry REVENUE.FORMAT has been transported. NOTE: Entry DEPT.FORMATC has been transported.
Procedure features:
PROC CPORT statement options:
AFTER=
FILE=
This example shows how to use PROC CPORT to transport only the catalog entries with modification dates equal to or later than the date you specify in the AFTER= option.
Assign library references. The LIBNAME and FILENAME statements assign a libref for the source library and a fileref for the transport file, respectively.
libname source ' SAS-data-library '; filename tranfile ' transport-file ' host-option(s)-for-file-characteristics ;
Specify the catalog entries to be written to the transport file. AFTER= specifies that only catalog entries with modification dates on or after September 9, 1996, should be written to the transport file.
proc cport catalog=source.finance file=tranfile after='09sep1996'd; run;
PROC CPORT writes messages to the SAS log to inform you that it began the export process for all the entries in the specified catalog. However, PROC CPORT wrote only the entries LOAN.FRAME and LOAN.HELP in the FINANCE catalog to the transport file because only those two entries had a modification date equal to or later than September 9, 1996. That is, of all the entries in the specified catalog, only two met the requirement of the AFTER= option.
NOTE: Proc CPORT begins to transport catalog SOURCE.FINANCE NOTE: The catalog has 5 entries and its maximum logical record length is 866. NOTE: Entry LOAN.FRAME has been transported. NOTE: Entry LOAN.HELP has been transported.