![]() |
![]() |
||||
|
SAS PIPESReading compressed files with the SAS PIPE feature
ABSTRACTThe SAS PIPE feature can be used to read compressed raw data files on the fly, without decompressing them in a separate step before running SAS.
DESCRIPTIONThe unix ``gzip'' command commonly achieves compression ratios of 80% for raw data files (see ``man gzip''). These compressed files (.gz files) can easily be read by SAS using its PIPE feature.As an example, suppose you compress a raw data file named ``labor'': gzip -v laborThe resulting compressed file will be named ``labor.gz''. You can uncompress it with the ``gunzip'' command: gunzip labor.gzThe resulting *uncompressed* file will be named ``labor''. You can also view the file without uncompressing it to another file with the combination of two commands, piping the results of the first command into the second: gunzip -c labor.gz | moreThe ``gunzip'' command uncompresses the file ``labor.gz'' putting its results to standard output, which is piped via the operator ``|'' as standard input to the ``more'' command. The SAS PIPE feature works in the same way, piping the results (i.e. standard output) of a program to the SAS I/O system. To read the compressed ``labor.gz'' file, use the following SAS FILENAME statement: FILENAME labor PIPE 'gunzip -c labor.gz';With this statement, SAS will use gunzip to decompress the file directly, without having to create an intermediate (uncompressed) disk file. Try it!
For further informationSee the ``SAS Companion for the UNIX Environment and Derivatives'' in the section ``Reading from and Writing to UNIX Commands'' on page 119 of the Version 6 First Edition. And see the man page for gzip, gunzip and gzcat, `man gzip'.
|
|||||
![]() |
Services |
Get Connected |
Support |
Educational Resources |
NUIT
|
|