COMPRESS= Table Option

Specifies how rows are compressed in a new output data set.

Category: Table Control
Restrictions: Use with output tables only.
In SPD Engine data sets, cannot be used with ENCRYPT=YES or ENCRYPT=AES.
Data source: SAS data set, SPD Engine data set

Syntax

COMPRESS= NO | YES | CHAR | BINARY

Arguments

NO

specifies that the rows in a newly created table are uncompressed (fixed-length records).

YES | CHAR

specifies that the rows in a newly created table are compressed (variable length records). SAS data sets are compressed. by using Run Length Encoding (RLE). RLE compresses rows by reducing repeated consecutive characters (including blanks) to two-byte or three-byte representations. SPD Engine data sets are compressed by using the run length compression algorithm SPDSRLC2.

Alias ON
Tip Use this compression algorithm for character data.

BINARY

specifies that the rows in a newly created SAS data set are compressed by SAS by using Ross Data Compression (RDC). RDC combines run-length encoding and sliding-window compression to compress the table. SPD Engine data sets are compressed by the SPD Engine by using SPDSRDC.

Tip This method is highly effective for compressing medium to large (several hundred bytes or larger) blocks of binary data (numeric variables). Because the compression function operates on a single record at a time, the record length needs to be several hundred bytes or larger for effective compression.

Details

Compressing a table is a process that reduces the number of bytes required to represent each row. Advantages of compressing a table include reduced storage requirements for the table and fewer I/O operations necessary to read or write to the data during processing. However, more CPU resources are required to read a compressed table (because of the overhead of uncompressing each row). Also, there are situations where the resulting file size might increase rather than decrease.
Use the COMPRESS= table option to compress an individual table. Specify the option for an output table only—that is, a table name on the CREATE TABLE statement.
Note: In SPD Engine data sets, encryption and compression are mutually exclusive. You cannot specify encryption for a compressed SPD Engine data set. You cannot compress an encrypted SPD Engine data set.
After a table is compressed, the setting is a permanent attribute of the table, which means that to change the setting, you must re-create the table. That is, to uncompress a table, you must drop the table by using the DROP TABLE statement and re-create the table with the CREATE TABLE statement and the COMPRESS=NO option.
When you specify COMPRESS= to compress an SPD Engine data set, the table drivers compress, by blocks, the table as it is created. To specify the size of the compressed blocks, use the IOBLOCKSIZE= Table Option. The SPD Engine table driver also supports the PADCOMPRESS= table option when creating or updating the SPD Engine data set. The PADCOMPRESS= option enables you to add padding to the newly compressed blocks. See the

Comparisons

The COMPRESS= table option overrides the COMPRESS= connection string option.
SAS data sets only: When you create a compressed table, you can also specify the REUSE=YES table option in order to track and reuse space. With REUSE=YES, new rows are inserted in space freed when other rows are updated or deleted. When the default REUSE=NO is in effect, new rows are appended to the existing table.