of the Month
Despite procedures like CPORT and CIMPORT that put data into a way that it can be copied from one computer to another, the old Version 5 Transport file is still the most common way of transferring data between computers, apart for TAB delimited for CSV files (that for another day). One reason is that the Version 5 Transport file format is in the public domain while the format created and read by CPORT and CIMPORT is not.
The limitations of the Version 5 Transport files are that they can only contain data (no view or catalogs for example), have variable names that are SAS version 5/6 compatible (starting with a character A-Z, no spaces, and be a maximum of 8 characters in length), and character variables of no more than 200 characters. Procedures CPORT and CIMPORT have no such limitations.
The most common way to create a Version 5 Transport file is the use of the COPY procedure, as the following example demonstrates:
libname derived_data 'C:\TAWI\RAWDATA'; libname xportout xport 'C:\TAWI\TRANSFER\TR002.XPT'; proc copy in=derived_data out=xportout memtype=data; run;
In the example the datasets in the directory
referenced by the LIBNAME DERIVED_DATA are copied into
the transfer file TR002.XPT. It is also possible to use
the SELECT and EXCLUDE statements to restrict the
datasets that are processed. SAS documentation suggests
that it is important to use the "memtype=data"
option so that files selected for the transfer are only
those of dataset type. I personally suggest the use of
the XPT filename extension as this is the most way
Version 5 Transport files are named.
To restore a Version 5 Transport file using the COPY procedure is done a similar way, as the following example demonstrates:
libname xportin xport 'C:\TAWI\TRANSFER\TR002.XPT '; libname derived_data 'C:\TAWI\RAWDATA '; proc copy in=xportin out=derived_data; run;
In the example all the datasets that are in the transport file TR002.XPT are restored in the directory referenced by the LIBNAME DERIVED_DATA, however this can be restricted if need be by the SELECT and EXCLUDE statements in the COPY procedure call.
Updated June 1, 2008