![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS Companion for UNIX Environments |
| Reading and Writing SAS Files on Tape |
You can write SAS files directly to tape using the TAPE
engine; however, it is more efficient to use a staging directory so that the
files can be processed directly from disk. You can use the UNIX
tar command to move SAS data sets between the
staging directory and tape.
| LIBNAME libref V7TAPE 'tape-device-pathname'; |
For example, the following LIBNAME statement assigns
the libref SEQ2 to the
/dev/tape2 tape device. Because the
tape device is specified, the engine does not have to be specified.
libname seq2 '/dev/tape2';
| Reading and Writing Transport Formats on Tape |
Transport formats on tape are handled in a manner similar to external files. Read Processing Files on TAPE before continuing with this topic.
For example, the following SAS statements issue the
UNIX
mt command to rewind
the tape and create a transport file using the xport engine and PROC CPORT:
x 'mt -t /dev/rmt/0mn rewind'; libname tranfile xport '/dev/rmt/0mn'; proc cport library=sasuser file=tranfile; run;The following statements import the transport file into the WORK data library:
x 'mt -t /dev/rmt/0mn rewind'; libname tranfile xport '/dev/rmt/0mn'; proc cimport infile=tranfile library=work; run;
| Writing Sequential Data Sets To Named Pipes |
LIBNAME libref <TAPE> 'pipename';
For example, suppose you want to create a SAS data set
and compress the data set without creating an intermediate, uncompressed data
set. Create a named pipe (such as
mypipe) and enter the
compress command:
mknod mypipe p compress <mypipe >sasds.Z
In your SAS session, assign a libref to the pipe and begin writing to the data set:
libname x 'mypipe'; data x.a; ... output; run;
The data is sent to
mypipe, compressed, and
written to the data set. When SAS closes the data set, the compress finishes,
and you have a compressed, sequential data set in
sasds.Z.
If you begin writing to a named pipe before the task
on the other end (in this case, the
compress command) begins
reading, your SAS session will be suspended until the task begins to read.
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.