SAS Transport Files

Stat/Transfer will read and write data sets in the SAS Transport Format.  This is, according to the SAS Institute, the "best overall format" for interfacing with other systems because it is consistent across all host environments.


If you are downloading or uploading SAS data between computers, be sure to use an error-correcting file transfer protocol that is suitable for binary files.


Standard extension:  xpt


Working with Transport Files within SAS

The method for writing (and reading) transport files within SAS unfortunately varies across versions of SAS.


For users of release 6.x and higher, the file can be written by any DATA or PROC step that creates SAS data sets and, similarly, it can be read by any DATA or PROC step.  Most commonly, PROC COPY is used to write (or to read) transport data sets.  If you are using Version 6.06 or higher, you can read or write transport files by using the XPORT engine.  To do so, you must name the XPORT engine in the LIBNAME statement.


For example, in Version 6.06 and higher the following code will write a transport file:


/*   read system file 'old' - write transport file 'trans' */

      libname old file-specification;

      libname trans xport file-specification;

      proc copy in=old out=trans;



The resulting transport file can then be used for a Stat/Transfer data transfer.


If a transport file has been produced by Stat/Transfer, it can be read in SAS with the following:


/*   read transport file 'trans' - write system file 'new' */

      libname trans xport file-specification;

      libname new file-specification;

      proc copy in=trans out=new ;



Note that you should not use PROC CPORT to write files that are to be read by Stat/Transfer.  This procedure creates files in an entirely different and incompatible format.


Reading SAS Transport Files

More than one data set may be stored in a single transport file. If Stat/Transfer finds more than one data set in a file, it will allow you to select the one you want.


Writing SAS Transport Files

When Stat/Transfer writes a SAS transport file, it uses the file name of the input file, without the extension, as the internal name for the data set in the output file.  Stat/Transfer will write only one data set to each output file.


Missing Data

SAS supports the missing values 'A' - 'Z', '.' and '._'.



On input, when a SAS file is transferred to a Stata file or an ASCII file with extended missing values specified, the SAS input missing values will be transferred to the equivalent ones in the output file, with the exception that any missing values '._' in the input SAS file will be written out as '.' in the output.  For all other output formats, all of SAS's missing values are converted to a single internal missing value in Stat/Transfer.



When either an ASCII file or a Stata file with extended missing values is transferred to a SAS file, the input missing values will transfer to the equivalent SAS ones.


For input files that support user missing values (SPSS and OSIRIS), the options User Missing Value and Map to extended (a-z) missing in the Options dialog box can be used to map selected user missing values to extended missing values in the SAS output file.


For all other file formats, on output to SAS missing values are set to '.', the SAS standard missing value.


Output Variable Types

The output variable type that results from each target variable type is given in the following table:




Target Type

Output Type



SAS Number - width three bytes



SAS Number - width four bytes



SAS Number - width six bytes




SAS Number - width eight bytes



SAS Character variable (maximum length of 200 bytes



SAS Serial Date Number



SAS Time (number of seconds since midnight)



SAS Datetime (in seconds