Skip to main Content

The COMPBL Function for Compressing Embedded Blanks

The COMPBL function will remove all leading and trailing blanks but will retain single embedded blanks, which is useful for name fields.  Consider the following SAS Program:

data _null_;
input @1 name $20.;
name=compbl(name);
put name=;
datalines;
Amadeus Software
run;

Log:
55   data _null_;
56     input @1 name $20.;
57     name=compbl(name);
58     put name=;
59
60   datalines;
name=Amadeus Software 
NOTE: DATA statement used (Total process time):
      real time           0.39 seconds 
      cpu time            0.00 seconds
62   run;