SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Search||next

Transforming Data with SAS Functions
Modifying Character Values with Functions


Keep in mind that the INDEX function is case sensitive, so the character string you are searching for must be specified exactly as it is recorded in the data set. For example, the INDEX function shown below would not locate any employees who have word processing experience.
     index(job,'WORD PROCESSING')

SAS Data Set Hrd.Temp
Job Contact Department Site
word processing WORD PROCESSOR DP 26
filing, administrative duties ADMIN. ASST. PURH 57
organizational dev. specialist CONSULTANT PERS 34
bookkeeping, word processing BOOKKEEPER ASST. BK 57


Finding a String in Any Case

To ensure that all occurrences of a character string are found, you can use the UPCASE or LOWCASE function with the INDEX function. The UPCASE and LOWCASE functions enable you to convert variable values to uppercase or lowercase letters. You can then specify the character string in the INDEX function accordingly.

     index(upcase(job),'WORD PROCESSING')

     index(lowcase(job),'word processing')

The UPCASE and LOWCASE functions are presented in the next section.


|next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement