COMPRESS= Table Option

Compresses SPD Server tables on disk.

Valid in: SPD Server
Default: No
Restriction: A server table cannot be encrypted if it is compressed.
Interactions: Corresponding macro variable is SPDSDCMP. If you specify values for both the COMPRESS= table option and the SPDSDCMP macro variable, the SPDSDCMP setting overrides the COMPRESS= setting.
Use COMPRESS= in conjunction with the IOBLOCKSIZE= table option.

Syntax

COMPRESS=NO | YES | CHAR | BINARY

Required Arguments

CHAR|YES

specifies that data in a newly created table be compressed by SAS using run-length encoding (RLE). RLE compresses data by reducing repeated consecutive characters (including blanks) to 2-byte or 3-byte representations. Use the YES or CHAR argument to enable RLE compression for character data. The two arguments are functionally identical and interchangeable.

BINARY

specifies that the data in a newly created table be compressed by SAS using Ross Data Compression (RDC). RDC combines run-length encoding and sliding-window compression to compress the file. Use the BINARY argument to compress binary and numeric data. This method is highly effective for compressing medium to large (several hundred bytes or larger) blocks of binary data.

NO

specifies that the data in the table is not to be compressed.

Details

When COMPRESS=YES is specified, the server compresses newly created tables by 'blocks' based on the algorithm specified. To control the amount of compression, use the table option IOBLOCKSIZE=. This option specifies the number of rows that you want to store in the block.
When COMPRESS=BINARY is specified, both numeric data and character data are compressed.
Note: Once a compressed table is created, you cannot change its block size. To resize the block, you must use PROC COPY to create a new table from this table, setting IOBLOCKSIZE= to the block size desired for the output table.

Examples

Example 1: Using the COMPRESS=YES Table Option

data mylib.CharRepeats(COMPRESS=YES);
   length ca $ 200;
   do i=1 to 100000;
      ca='aaaaaaaaaaaaaaaaaaaaaa';
      cb='bbbbbbbbbbbbbbbbbbbbbb';
      cc='cccccccccccccccccccccc';
      output;
   end;
run;
The following message is written to the log:
NOTE: Compressing table MYLIB.CHARREPEATS decreased size by 93.34 percent.

Example 2: Using the COMPRESS=BINARY Table Option


data mylib.StringRepeats(COMPRESS=BINARY);
   length cabcd $ 200;
   do i=1 to 1000000;      
      cabcd='abcdabcdabcdabcdabcdabcdabcdabcd';
      cefgh='efghefghefghefghefghefghefghefgh';
      cijkl='ijklijklijklijklijklijklijklijkl';
      output;
   end;
run;


The following message is written to the SAS log:
NOTE: Compressing table MYLIB.STRINGREPEATS decreased size by 97.85 percent.

See Also

SPD Server macro variables:
SPD Server table options:
Last updated: February 8, 2017