College of Natural Sciences
 
FAQs
This is for IE7 to hold div open

SAS FAQ #31: Transfer of SAS datasets

Question:

I tried to transfer a SAS dataset from one computer system to another, but I can't read it on the new computer system. What do I need to do differently?

Answer:

SAS datasets will only work on the same type of computer where the datasets were created. For example, if you created a SAS dataset on a computer running MS-Windows, you could only use that SAS dataset on other computers running MS-Windows.

To move a SAS dataset from one computer to another computer running a different operating system than the first computer, you should use a SAS transport dataset. SAS transport datasets may be read on any type of computer system.

There are three steps for transferring a SAS dataset from one computer system to another: (1) Create a SAS transport dataset copy of the SAS dataset on the originating computer system, (2) transfer the newly-created SAS transport file from the originating computer system to the destination computer system, and (3) convert the SAS transport file to a permanent SAS dataset on the destination computer system.

1. Create a SAS transport dataset on the originating computer system

To convert your SAS dataset to transport format, use the PROC COPY command. The following code demonstrates the conversion of the sas dataset mylib.one from a standard SAS dataset to a transportable dataset called outfile.xpt.

The sample program assumes that the SAS dataset mylib.one already exists and that it is written to the directory c:\temp. The program also writes the SAS transport dataset to a separate subdirectory called \users\temp2.

LIBNAME mylib 'c:\temp' ;
LIBNAME trans XPORT 'c:\users\temp2\outfile.xpt' ;

PROC COPY IN=mylib OUT=trans ;
RUN ;

This example assumes that you are moving your data from MS-Windows to a UNIX system, but the same code will work for any combination of operating systems. All you need to change is the host-specific ways in which file names are specified on each system. For instance, if you were using an Apple Macintosh computer instead of a MS-Windows computer, you would alter the first line of the program to read

LIBNAME mylib 'Macintosh Hardisk:Desktop Folder' ;
LIBNAME trans XPORT 'Macintosh Hardisk:Desktop Folder:users:temp2:outfile.xpt' ;

Note that transport datasets can contain more than one SAS dataset. The SAS code used to create SAS transport datasets in the code shown above incorporates this feature. For example, if there were a second SAS dataset located in the SAS library "mylib", it would be bundled into the transport dataset "outfile.xpt" along with the SAS dataset mylib.one. You are now ready to transfer your newly-created SAS transport data file from the originating computer system to the destination computer.

2. Transfer the SAS transport data file

Once you create the transport dataset, you must set your FTP (File Transfer Protocol) program to transport the dataset in binary format. If your FTP program permits multiple binary formats, choose raw data or image format. If you need help with file transfers in general or FTP, contact the HelpDesk at 475-9400.

3. Convert the SAS transport data file into a SAS permanent dataset

To read the transport dataset and convert it to a SAS dataset on the destination computer, use the PROC COPY procedure once again:

LIBNAME mylib '$HOME' ;
LIBNAME trans XPORT '$HOME/tmp/outfile.xpt' ;

PROC COPY IN=trans OUT=mylib ;
RUN ;

This program will create a file called one.ssdnn where nn is a number which varies from system to system. This is your SAS dataset. Since we used the UNIX variable $HOME to refer to our home directory, the new SAS dataset is written to the home directory, referred to by the SAS library mylib. If you packed multiple SAS datasets into the transport data file, the syntax shown immediately above will unpack them all in the same destination library.

If you plan to transport large SAS datasets, you may want to practice the transporting process with small sample datasets until you master the procedure.

For more information, click on the Help button in the SAS menu bar and scroll to SAS Help and Documentation.

If you have further questions, send E-mail to stats@ssc.utexas.edu.