Chapter Contents

Previous

Next
COMPRESS

COMPRESS



Removes specific characters from a character string

Category: Character


Syntax
Arguments
Examples
Example 1: Compressing Blanks
Example 2: Compressing Special Characters
See Also

Syntax

COMPRESS(source<, characters-to-remove>)

Arguments

source
specifies a source string that contains the characters to remove.

characters-to-remove
specifies the character or characters that SAS removes from the character string.
Tip: Enclose a literal string of characters in quotation marks.
Tip: If you specify nothing, SAS removes blanks from source.


Examples

Example 1: Compressing Blanks

SAS Statements Results

----+----1
a='AB C D ';
b=compress(a);
put b;
 

ABCD


Example 2: Compressing Special Characters

SAS Statements Results

----+----1
x='A.B (C=D);';
y=compress(x,'.;()');
put y;
 

AB C=D


See Also

Functions:

COMPBL
LEFT
TRIM


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.