I have a large compressed data set (.Z file) that I want to input to a SAS program without permanently uncompressing the data set to disk. I am using a UNIX system.
Using SAS on a UNIX system permits you to use a "pipe" to route the output of a UNIX command to a SAS DATA step or procedure. For instance:
FILENAME indata PIPE 'zcat data.Z' LRECL=192;
DATA temp1;
INFILE indata;
INPUT specification of data input;
Here zcat is the UNIX uncompression command being used to uncompress the raw data file named data.z (this file is assumed here to reside in your current working directory). Note that the "zcat" is specified in lowercase because it is a UNIX system command (UNIX is a case sensitive operating system). Note that the LRECL=192 command is needed to define the file length of the compressed data file.
If you are using a gzipped file (.gz format), you can use the same SAS syntax to uncompress the data file, except that you supply a different UNIX decompression command to SAS:
FILENAME indata PIPE 'gunzip -c data.gz' LRECL=192;
DATA temp1;
INFILE indata;
INPUT specification of data input;
Consult the Helpdesk at (512) 475-9400 for more information on the compression programs available. See the online SAS 9.2 Companion for the UNIX Environment for more details.
If you have further questions, send E-mail to stats@ssc.utexas.edu.