COMPBL Function


COMPBL Function

Removes multiple blanks from a character string

Category: Character

Syntax

COMPBL ( source )

Arguments

source

  • specifies the source string to compress.

Details

If the COMPBL function returns a value to a variable that has not yet been assigned a length, by default the variable length is determined by the length of the first argument.

The COMPBL function removes multiple blanks in a character string by translating each occurrence of two or more consecutive blanks into a single blank.

The default length of the value that COMPBL returns is the same as the length of the argument.

Comparisons

The COMPRESS function removes every occurrence of the specific character from a string. If you specify a blank as the character to remove from the source string, the COMPRESS function is similar to the COMPBL function. However, the COMPRESS function removes all blanks from the source string, while the COMPBL function compresses multiple blanks to a single blank and has no affect on a single blank.

Examples

The following SAS statements produce these results.

SAS Statements

Results

 

----+----1----+-----2--

  string='Hey   Diddle  Diddle';   string=compbl(string);   put string;  
  Hey Diddle Diddle  
  string='125    E Main St';   length address ;   address=compbl(string);   put address;  
  125 E Main  

See Also

Function:

  • 'COMPRESS Function' on page 458




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net