- Example 1:
- In this example, we are writing the transport file to tape. First, mount the tape using the appropriate command at your site. The tape should be nonlabeled.
Next, execute the following program, where 'B' in the LIBNAME SALES91 statement is the minidisk where your library resides. Only the data sets SEPT91 and OCT91 are copied to the
transport file on tape. TAP1 is the tape device associated with your session. You will need to substitute your tape device name in place of TAP1.
cms filedef tran tap1 nl
(recfm fb lrecl 80 blksize 8000;
run;
libname tran xport;
libname sales91 'b';
proc copy in=sales91 out=tran;
select sept91 oct91;
run;
- Example 2:
- Here we are creating a transport file during a SAS DATA step. The first LIBNAME statement declares where the SAS data library is located. The libref SASDATA
is the FILETYPE of the SAS data library on the A minidisk. See below for the abbreviated filelist command output.
Filename Filetype Fm
USERS SASDATA B1
The second LIBNAME tells SAS how to write the transport file, where it is to be stored, and what name to give it. The XPORT engine's special
set of input/output routines are used to create the transport file during the DATA step. The name of the transport file is enclosed in quotes. The transport file contains
all the variables and observations from the permanently stored SAS data set USERS, found in the directory referenced by the libref SASDATA plus the variable STATUS.
libname sasdata 'b';
libname gone xport 'tranfile data a';
data gone.account;
set sasdata.users;
if code='00003' then status='ALERT';
else status='REG';
run;
- Example 3:
- Here we are creating a transport file with all the SAS data sets in the B minidisk except for the EMPLOYEE and CONSULT SAS data sets. All the SAS data files
to be transported have the same filetype, SASDATA.
libname sasdata 'b';
libname gone xport 'tranfile data a';
proc copy in=sasdata out=gone;
exclude employee consult;
run;
- Example 4:
- This example is a modification of Example 1 above. In this example we are using PROC CPORT to create the transport file.
Note:
This transport file
can only be processed by a PROC CIMPORT at the same or higher release.
libname sasdata 'b';
filename gonefile 'portfile data a';
data work.account;
set sasdata.users;
if code='00003' then status='ALERT';
else status='REG';
run;
proc cport data=work.account file=gonefile;
run;
- Example 5:
- Here we are copying all the SAS data sets in the directory referenced by the libref SASDATA into the transport file, that is, all the SAS data sets with the filetype
SASDATA on the B minidisk.
libname sasdata 'b';
filename gonefile 'portfile data a ';
proc cport library= sasdata memtype=data file=gonefile;
run;
- Example 6:
- This example is the same as Example 5 except that we removed the FILENAME statement. Because SAS creates the transport file with the appropriate file characteristics
of FIXED record format and a logical record length of 80 automatically, we can simply code the location of the transport file in the FILE= option.
libname sasdata 'b';
proc cport library= sasdata memtype=data
file= 'portfile data a ';
run;