SAS at MIT

Topic: Transporting Data Sets
Category: FAQ
Last modified: Fri Dec 4 10:51:48 1998
Problems or Questions?


Introduction

SAS data sets are platform-dependent. This means that you cannot read an IBM data set on a UNIX machine, nor can you read a UNIX DECstation data set on a Sun running Solaris. To create a data set on one type of computer (machine-A) and read it on another (machine-B), you need to first convert it into an intermediate, or transport, format using SAS on machine-A. This intermediate file can be converted back to a data set on machine-B.

As of SAS Release 6.07, there are two procedures which help you to transport data sets between platforms. To create an intermediate data file, use PROC CPORT. To read an intermediate data file, use PROC CIMPORT.

Steps to Convert a Data Set

  1. On machine-A: To convert a SAS file into transport format use the SAS procedure CPORT. This procedure requires two arguments, the name of the data set to export and the name of a file to create in transport format. For example, the following SAS program creates a data file tdisney in transport format from the dataset disney:
           
           libname tmpref `/mit/jruser/sasfiles/;
           proc cport data=tmpref.disney file='/mit/jruser/sasuser/tdisney'; 
           run;
      
    Note that you may simply use the predefined libref SASUSER if the existing dataset is in your SASUSER data library.
  2. If you are not using shared file space to access the data on the two different machines, transport it to the remote machine.
  3. On machine-B: To convert a transport file into a SAS data set suitable for the machine you are now working on (i.e., to read the intermediate data form in on a different machine), use the SAS procedure CIMPORT. This procedure also requires two options, the name of the data set to create and the name of the transport file. For example, the following SAS program creates a data set on the new workstation with the data values from the old dataset:
     
           libname tref2 `/mit/jruser/newsasfiles;
           proc cimport ds=tref2.disney
           infile='/mit/jruser/sasfiles/tdisney'; run;
            
    If you completed these two steps on machine-A (a DECstation) and machine-B (a Sun), you will have three files related to the original data set. Two would be in the directory /mit/jruser/sasfiles (disney.ssd02 tdisney), and one in /mit/jruser/newsasfiles (disney.ssd01) If you used the SASUSER data library, the location of your files would be /mit/jruser/sasuser and /mit/jruser/sasuser/sun4m. You can now safely delete the transfer file (here tdisney) to help save disk space.
For more information about the CPORT and CIMPORT procedures, select the SAS Help menu option Extended Help, then choose Index, then the procedure of interest.

[ SAS Home Page | Software Home Page | MIT Home Page ]