O'Reilly logo

Combining and Modifying SAS® Data Sets: Examples Second Edition by Michele M. Burlew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example 9.18 Cleaning Character Data Values

Goal

Apply several data cleaning rules to a character variable. Modify the case of words according to value and position in the value.

Example Features

Featured StepDATA step
Featured Step Options and StatementsHash object in the DATA step COUNTW, LOWCASE, PROPCASE, and SCAN functions
Related TechniqueDATA 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required