Example 9.18 Cleaning Character Data Values
Apply several data cleaning rules to a character variable. Modify the case of words according to value and position in the value.
|Featured Step||DATA step|
|Featured Step Options and Statements||Hash object in the DATA step COUNTW, LOWCASE, PROPCASE, and SCAN functions|
|Related Technique||DATA step, macro variables|
Input Data Sets
The five observations in data set UNEDITED_TITLES have one character variable.
UNEDITED_TITLES Obs titletext 1 of interest to all 2 up at the crack of dawn 3 the best of ? 4 anything but... 5 OUTSIDE-IN AND INSIDE-OUT
Data set LCWORDS contains the words that should be lowercase in the edited text value.
LCWORDS Obs lcword 1 a 2 an 3 the 4 at 5 by 6 for 7 in ...