Posts

Showing posts with the label SCAN Function in SAS

HOW TO USE THE SCAN FUNCTION:

USING THE SCAN FUNCTION: SCAN (string,n,delimiters): returns the nth word from the character string string, where words are delimited by the characters in delimiters.  It is used to extract words from a  character value when the relative order of words is known, but their starting positions are not. NewVar= SCAN (string,n<, delimiters >); -returns the nth ‘word’ in the string   When the SCAN function is used: 􀂃 the length of the created variable is 200 bytes if it is not previously defined with a LENGTH statement 􀂃 delimiters before the first word have no effect When the SCAN function is used, 􀂃 any character or set of characters can serve as delimiters Points to remember while using SCAN Function: 􀂃 a missing value is returned if there are fewer than n words in string 􀂃 two or more contiguous delimiters are treated as a single delimiter 􀂃 if  n is negative, SCAN selects the word in the character string starting from the end of stri...