Psyc 7291: Multivariate Stats (Carey, 01-15-03)

 

TRANSPORTING SAS DATA SETS FROM ONE COMPUTER TO ANOTHER

 

STEP 1: Give a nickname to the directory that contains the SAS data sets that you wish to transport. In this example, I assume that you are transporting the data set from samiam to your home computer. The following statement assigns the nickname sasdata to the directory for multivariate statistics
LIBNAME sasdata '~carey/p7291dir';

STEP 2: Give a nickname to the directory and filename that will contain the transport data set. The following statement gives the nickname xprtdata to the file interest.xpt located in the directory tempdir on your account. Make certain to specify XPORT on the libname statement to make certain that SAS writes a transport data set..
LIBNAME xprtdata XPORT '~yourname/tempdir/sasxport.xpt';

STEP 3: Use PROC COPY to copy the data sets from the first directory (~carey/p7291dir) to the file specified in the second LIBNAME statement. For example,
PROC COPY IN=sasdata OUT=xprtdata;
RUN;
NOTE WELL: These two statements will copy all of the SAS data sets on directory ~carey/p7291dir into a single file called sasxport.xpt in the directory ~yourname/tempdir. If you want to transport only some of the SAS data sets on ~carey/p7291dir, then use the SELECT statement in PROC COPY. For example, the following statements copy the SAS only data sets "detroit" and "interests" from ~carey/p7291dir into file ~yourname/tempdir/sasxport.xpt.
PROC COPY IN=sasdata OUT=xprtdata;
SELECT detroit interest;
RUN:

STEP 4: Use ftp or sftp or some other file-transfer program to move the file ~yourname/tempdir/sasxport.xpt from the host computer to your computer. The commands for this will depend on your computer software for file transfers. Make certain that you use binary mode for the transfer .

STEP 5: After file transfer, fire up SAS on the your computer and assign libname statements. Make certain that you specify XPORT on the libname statement for the transported file. The following statement illustrates how to do this if you had downloaded the transport file to the directory c:\temp.
LIBNAME trnsdata XPORT 'c:\temp\sasxport.xpt';

STEP 6: Assign a LIBNAME statement for the directory where you want to save the SAS data sets. The following statement assigns the nickname mvstats to the directory c:\sas\mvstats.
LIBNAME mvstats 'c:\sas\mvstats';

STEP 7: Use PROC COPY to copy the SAS data sets into the directory. E.g.,
PROC COPY IN=trnsdata OUT=mvstats;
RUN;

The data sets in directory c:\sas\mvstats are now SAS data sets for the PC that can be opened, processed, and manipulated by SAS on your PC.