ARCHIVED: In SAS, how do I create a transport data set file?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

SAS transport data set files are machine-independent files that let you move SAS data sets between computers running different operating systems. You can directly read SAS transport data set files with several statistical software packages (e.g., SPSS and BMDP).

Following is sample SAS code that copies an SAS data set file (job1.sas7bdat) to an SAS transport data set file (~/outdata/portable.xpt):

  LIBNAME misc '~/work';
  LIBNAME sasxpt XPORT '~/outdata/portable.xpt';

  PROC COPY IN=misc OUT=sasxpt;
    SELECT job1;

  RUN;

In the example above:

  • The first LIBNAME statement aliases the library reference (libref) misc to the ~/work directory.
  • The second LIBNAME statement aliases the libref sasxpt with the physical name of the SAS transport format file (~/outdata/portable.xpt).
  • The COPY procedure copies one or more SAS data sets in the IN= libref (in this case, misc) to the OUT= libref (in this case, sasxpt).
  • The SELECT statement specifies that only the file job1.sas7bdat should be included in the transport file ~/outdata/portable.xpt.

Note: The filenames and pathnames in the above example follow Unix conventions. If you use SAS for Windows, use the appropriate Windows filename and pathname conventions. For example, in SAS for Windows, the two LIBNAME statements in the above example would instead be:

  LIBNAME misc 'c:\work';
  LIBNAME sasxpt XPORT 'c:\outdata\portable.xpt';

For more about using SAS, see the UITS Research Analytics SAS page and the following tutorials:

If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.

This is document aevb in the Knowledge Base.
Last modified on 2023-05-09 14:41:48.