Converting SAS data sets to transport files 

This document describes the steps necessary to move special SAS files (data sets, format catalogs, graphics catalogs, etc.) from one operating system to another.

There are several ways to convert and transfer SAS data sets and catalogs. Most conversion methods treat SAS data sets and catalogs separately. The method described in this document treats all special SAS files in a directory as a SAS data library and converts all members of the library simultaneously, creating a single transport file. The examples used in this document assume that you are creating transport files from SAS data sets on zoo and transferring them to a PC to use with SAS in Windows.

The Conversion and Transfer Procedure

The procedure can be summarized in three steps. First, convert the SAS data library on first system to a SAS transport file. Second, transfer the transport file to the second system using ftp. Finally, convert the transport file back to a SAS data library on second system. These steps are detailed below:
  1. Using the following SAS program, cport.sas, as an example, convert a SAS data library to a transport file. This program assumes that you want to transfer all members of the SAS data library contained in your current directory.
  2.    libname saslib '.';
       proc cport library=saslib file='transprt.ssp';
       run;
    Note: If you are creating a transport file with version 6.12 of SAS, but will be transferring to a system running a version of SAS less than 6.12, you must add the following option to the proc cport statement: sortinfo=no.

    Multiple SAS transport files may be created in the same program. The following program creates two SAS transport files, each containing a different SAS data library:

       libname saslib1 '~/project1';
       proc cport library=saslib1 file='project1.ssp';
       run;
       libname saslib2 '~/project2';
       proc cport library=saslib2 file='project2.ssp';
       run;
    
    
    Run the cport.sas program to create the transport file:
       sas cport
    Check the SAS log file (cport.log) for errors.
  3. Transfer the transport file to the other system using ftp. Make sure the transfer is done in binary mode, not ASCII. In the following example, commands in italics are those you must type.
  4. Convert the transport file back to a SAS data library on the other system, using the following program, cimport.sas, as an example. This program will create the SAS data library in your current directory.
  5.    libname saslib '.';
       proc cimport library=saslib infile='transprt.ssp' ;
       run;
    Multiple SAS transport files may be processed in the same program. The following program recreates two SAS data libraries from two separate transport files, placing one library in the subdirectory called project1, and the other library in another subdirectory called project2:
       libname saslib1 'C:\project1';
       proc cimport library=saslib1 infile='project1.ssp' ;
       run;
       libname saslib2 'C:\project2';
       proc cimport library=saslib2 infile='project2.ssp' ;
       run;
    
    
    Run the cimport.sas program to recreate the SAS data library on the other system.

    Check the SAS log file (cimport.log) for errors.

Q & A

Now here are some questions (with answers!) you may have about SAS system files and this conversion process.

Q: What are SAS data libraries and how can I tell if I have any?

A: SAS data libraries are collections of special binary files created by SAS. A SAS data library is usually nothing more than the special SAS files contained in a subdirectory. They can contain SAS data sets, format catalogs, graphics catalogs, template catalogs, and several other types of special SAS files. SAS data sets contain all the original data, plus any new computed or recoded variables, variable labels, formats, etc. On zoo, all SAS data sets have the extension .ssd01. In Windows, SAS data sets have the extension .sd2. SAS catalogs can contain formats created by PROC FORMAT, graphs created by procedures in SAS/GRAPH, or many other types of special SAS files. SAS catalogs on zoo have the extension .sct01 and in Windows, they have a .sc2 extension.

Q: This conversion process sounds complicated. Is there an alternate procedure?

A: Yes. If you still have ASCII files containing the original raw data and SAS program files which created the SAS data set and/or formats, graphs, etc., you could simply transfer the data and program files. Once there, you would just rerun the SAS program, which would read the data from the ASCII file and recreate the SAS data set and catalogs.

There is a drawback to this, however. You may have run other SAS programs which computed new variables, recoded variables, or modified or added to the data or catalogs in some way. You would need to find all these extra SAS programs, transfer them to the new system, and rerun them after they were transferred.

Q: I know how to do a binary file transfer with ftp. Why can't I just transfer my SAS files from one computer to another?

A: While you can successfully do a binary transfer of special SAS files, the operating system on the receiving end will not be able to interpret the information in the files. Binary files are specific to an operating system (like MS-DOS, VMS, or Unix). A SAS data set or catalog created on zoo (for example) can be used only on zoo (or on another AIX system). Likewise, a SAS data set or catalog created in Windows can be used only in the Windows version of SAS (on your PC or on someone else's machine).