NC STATE University
Department of Statistics

Transport files

MOVING SAS DATA SETS: TRANSPORT FILES


Now that we have easy access to PCs, SUN workstations, and the IBM mainframe, the need to move files between these systems has arrived. How is this done?

If you have an ascii file there is no problem using kermit or ftp, however, if you have a SAS data file the process is more complicated. You can either output an ascii file, use SAS Connect, our create and transfer transport files.

Transport files are the best choice for moving large data sets or whole data set libraries.

What is a transport file?

A transport file is a sequential file containing one or more data sets or catalogs in transport format. "Transport format" is a format understood by all versions of SAS on all systems. There is one transport format for data sets; it is the same for all releases and all host environments.

Transport format for catalogs may be different for different releases, but is the same for all host environments running the same release. Because of many enhancements in Version 6 of the SAS System, you usually cannot move catalog entries from an operating system running a newer release of the SAS system to an operating system running an older release.

When is a transport format file necessary?

You must convert a SAS file to transport format in order to move it between machines if the machines have a binary incompatibility such as different representations of floating point numbers. In many cases, however, you do not have to use transport format to move a SAS file from one IBM mainframe to another, even if the two machines are running different operating systems.

Precision and accuracy of transported data.

When you transport data from one host environment to another, you may encounter problems with the precision of data values on the new host system. This problem is related to the differing methods of storing floating point numbers on various hosts. For more information on numeric precision in transport files, refer to Chapter 3 of SAS Language: Reference, Version 6, First Edition.

In addition, if you transport from an ASCII-based system to an EBCDIC-based system and then back again, some print characters may be translated to values different from their original values.

Moving data with transport files is a three step process:

  1. Create transport file using PROC COPY (PROC XCOPY in version 5.18)
  2. Move the transport file to new host machine 3) Restore the library using PROC COPY (PROC XCOPY for version 5.18)

Note: To move full screen and graphics catalogs, use PROC CPORT and PROC CIMPORT. For more information see SAS Technical Report P-195, Transporting SAS Files Between Host Systems.

STEP 1: CREATING TRANSPORT FILES

The exact syntax for creating transport files is system and version of SAS dependent. Below are 4 examples; use the example for your system and version of SAS. You must provide your own information wherever the example text is italicized.

System/Version: PC / SAS Version 6.03 or 6.04

libname in 'c:\mysas\lib1'; /*supply a directory*/
libname out sasv5xpt 'lib1x.pc';/*supply a filename*/
proc copy in=in out=out memtype=data;
*select stats team1-team4 rbi:; /*optional statement*/
*exclude rbi: ; /*optional statement*/
run;

/*You may use either a select or exclude statement but not both. If
neither is used all data sets will be included. rbi: means all data
sets that begin with rbi */


System/Version: SUN / SAS Version 6.03 or 6.07

libname in '~/mysas/lib2'; /* supply a directory*/
libname out xport 'lib2x.sun'; /* supply a filename*/
proc copy in=in out=out memtype=data;
*select datasets; /* optional statement*/
*exclude datasets; /* optional statement*/
run;

/* Either a select or exclude statement may be used, but not both. If
neither is used all data sets will be included. */


System/Version: Mainframe / SAS Version 5.18

//EXPORT JOB ACCTNUMBER,NAME
// EXEC SAS
//IN DD DSN=USERID.LIBNAME,DISP=SHR
//OUT DD DSN=USERID.FILENAME,DISP=(NEW,CATLG),
// UNIT=DISK,SPACE=(TRK,(2,2),RLSE),
// DCB=(LRECL=80,BLKSIZE=8000,RECFM=FB)

PROC XCOPY IN=IN OUT=OUT EXPORT;
*SELECT TEST;
*EXCLUDE TEST;

***NOTE: Either SELECT or EXCLUDE may be used, but
***not both. If neither is used, all data sets in the
***library will be included.;


System/Version: Mainframe / SAS Version 6.06

//EXPORT6 JOB ACCTNUMBER,NAME
// EXEC SAS606
//OUT DD DSN=USERID.FILENAME,DISP=(NEW,CATLG),UNIT=DISK,
// SPACE=(TRK,(5,5),RLSE),
// DCB=(LRECL=80,DSORG=PS,BLKSIZE=8000,RECFM=FB)
//IN DD DSN=USERID.LIBRARYNAME,DISP=SHR
LIBNAME OUT XPORT;
PROC COPY IN=IN OUT=OUT MEMTYPE=DATA;
*SELECT DATA1-DATA4;
*EXCLUDE DATA3;

***NOTE: Either a select or exclude statement may
***be used, but not both. If neither is used all
***data sets will be included.;


STEP 2: MOVING TRANSPORT FILES

Transport files can be moved with kermit or ftp. With both methods, you must specify a binary transfer. Also, when you are moving files to the mainframe, special steps must be taken to assure that the file will be stored with the attributes SAS expects.

To learn about moving files with ftp see TRANSFERRING FILES TO AND FROM SRCIS: A GUIDE TO USING FTP, or use the UNIX command man ftp.To learn about moving files with kermit see Using MS-DOS Kermit by Christine M. Gianone. Both Kermit and FTP provide good online help; enter either help or ? .

Script for moving files from Mainframe to PC

This example shows use of kermit; ftp is faster, so use it if you can. Commands you need to enter are in italic.

Logon to mainframe as usual.
At the READY prompt: kermit
KERMIT-TSO> set file type binary
KERMIT-TSO> send filename
Look for message "escape to local kermit"> ctrl ] c
MS-KERMIT> set file type binary
MS-KERMIT> receive filename
When complete, and MS-KERMIT prompt returns, enter: c
KERMIT-TSO> quit

Script for moving file from PC to Mainframe

This example shows use of kermit; ftp is faster, so use it if you can. Commands you need to enter are in italic. Connect to the mainframe as usual. At the READY prompt: kermit
KERMIT-TSO> set file type binary
KERMIT-TSO> set file blksize 8000 lrecl 80 recfm fb primary 5 secondary 10
KERMIT-TSO> receive filename
Look for message "escape to local kermit"> ctrl ] c
(This is executed by entering ] while ctrl is depressed, and then entering c)
MS-KERMIT> set file type binary
MS-KERMIT> send filename
When transfer is complete and MS-KERMIT prompt returns enter> c
KERMIT-TSO> quit

Script for moving files from Mainframe to SRCIS: 2 Methods

  1. Connect to the Mainframe and put file on SRCIS.
    Commands you need to enter are in italic.
    Connect to the mainframe as usual.
    At READY prompt: ftp essss1.stat.ncsu.edu
    identify yourself to the host:
    FTP....command> binary
    Look for note, "Type set to I", (image)
    FTP....command> hash ## signs let you know transfer is in progress.
    FTP....command>put filename
    Look for note, "Binary transfer complete".
    FTP...command> quit
  2. Connect to SRCIS and get file from Mainframe.
    Commands you need to enter are in italic.
    Connect to the SRCIS as usual.
    At system prompt: ftp ncsumvs
    Identify yourself to the host:
    ftp> binary
    Look for note "Type set to I" (I stands for image)
    ftp> hash
    ## signs let you know transfer is in progress.
    ftp> get filename
    Look for note "Binary transfer complete".
    ftp> quit

Script for moving files from SRCIS to Mainframe: 2 Methods

  1. Connect to the Mainframe and get file from SRCIS
    Commands you need to enter are in italic.
    Connect to the mainframe as usual.
    At READY prompt: ftp essss1.stat.ncsu.edu
    Identify yourself to the host:
    FTP....command> binary Look for note, "type set to I", I for image
    FTP....command> hash
    ## signs let you know transfer is in progress.
    FTP....command> locsite recfm=fb lrecl=80 blksize=8000
    FTP....command> locsite primary=5 secondary=5
    FTP....command> get filename
    Look for note "Binary Transfer complete"
    FTP...command> quit
  2. Connect to SRCIS and put file on Mainframe
    Commands you need to enter are in italic.
    Connect to the SRCIS as usual.
    At system prompt: ftp ncsumvs
    Identify yourself to the host:
    ftp> binary Look for note "Representation type is Image"
    ftp> hash
    ## signs let you know transfer is in progress.
    ftp> quote site recfm=fb lrecl=80 blksize=8000
    Note: Site command was accepted.
    ftp> quote site primary=5 secondary=5
    Note: Site command was accepted.
    ftp>put filename
    Look for note "Transfer completed successfully."
    ftp> quit

If you have ftp, follow directions for moving files between SRCIS and MF. However,if all you have is kermit, I would suggest you kermit your files to the mainframe and then ftp them to SRCIS or reverse this process for moving a file from SRCIS to the PC. This is recommended due to problems kermit has communicating between PCs and SRCIS. The other option would be to take them to the lab on a dos disk and read them in. Use show_notes dos_disks.

STEP 3: RESTORING TRANSPORT FILES

The exact syntax for restoring transport files is system and version of SAS dependent. Below are 4 examples; use the example for your system and version of SAS. You must provide your own information wherever the example text is underlined.

System/Version: PC / SAS Version 6.03 or 6.04


libname in sasv5xpt 'filename'; /*transport file*/
libname out 'mysaslibrary'; /*destination directory;*/
proc copy in=in out=out;
Note: Destination directory must already exist.


System/Version: SUN / SAS Version 6.03 or 6.07


libname in xport 'filename'; /*transport filename*/
libname out '~/mysaslibrary'; /*desired directory destination*/
proc copy in=in out=out;
run;

Note: Destination directory must already exist.

System/Version: Mainframe / SAS Version 5.18


//IMPORT JOB ACCTNUMBER,NAME
// EXEC SAS
//IN DD DSN=USERID.FILENAME,DISP=SHR
//OUT DD DSN=USERID.LIBRARY,DISP=(NEW,CATLG),
// UNIT=DISK,SPACE=(TRK,(2,2),RLSE)
PROC XCOPY IN=IN OUT=OUT IMPORT;


System/Version: IBM Mainframe / SAS Version 6.06


//IMPORT6 JOB ACCTNUMBER,NAME
// EXEC SAS606
LIBNAME IN XPORT 'USERID.FILENAME';
LIBNAME OUT 'USERID.LIBRARY' DISP=NEW SPACE=(TRK,(2,2),RLSE);
PROC COPY IN=IN OUT=OUT;



Go to: SAS Consulting Home Page
           Department of Statistics Home Page

Maintained by: Sandy Donaghy and Joy Smith
Last Modified: July 3, 1997