COMPBL(Compress blanks)
!) Function: COMPBL
Purpose: To replace all occurrences of two or more blanks with a single blank character. This is particularly useful for standardizing addresses and names where multiple blanks may have been entered.
Syntax: COMPBL(character-value)
character-value is any SAS character value.
If a length has not been previously assigned, the length of the resulting
variable will be the length of the argument
Example: Using the Combl function to convert multiple blanks to single blank.
***Primary
function: COMPBL;
data squeeze;
input #1 @1 Name $20.
#2 @1 Address $30.
#3 @1 City $15.
@20 State $2.
@25 Zip $5.;
Name = compbl(Name);
Address = compbl(Address);
City = compbl(City);
datalines;
Ron Cody
89 Lazy Brook Road
Flemington NJ
08822
Bill Brown
28 Cathy Street
North City NY
11518
;
run;
title 'Listing of Data Set SQUEEZE';
proc print data=squeeze;
id Name;
var Address City State Zip;
run;
Explanation
Each line of the address was passed through the COMPBL function to replace any sequence
of two or more blanks to a single blank. Here is a listing of data set SQUEEZE.
Comments
Post a Comment