SAS String Function COMPBL( )
COMPBL () function has been demonstrated below;
SAS COMPBL( ) Function.
SYNTAX: COMPBL (char_string);
<< Go Back To SAS String Functions
SAS COMPBL () function is useful for removing multiple blanks from the string. It removes all repeating occurrences of blanks and keeps only the single once. It’s generally used to standardize the Name and Address fields of personal information.
Example: SAS COMPBL( ) Function
SAS Code:
data temp;
name = "ROB K THOMAS";
std_name = COMPBL(name);
run;
proc print data = temp;
run;
PROC PRINT OUTPUT :
Obs
1
name
ROB K THOMAS
std_name
ROB KTHOMAS
* Please note this code has compiled on SAS 9.2 Platform.
We can observe from the output that; multiple blanks between “ROB” and “K” have been replaced by single blank.
But it’s more important to note that the “TAB” character between “K” and “THOMAS” has been removed completely; causing the two parts of the strings getting merged in the output.