- SCAN extracts words within a value that is marked by delimiters.
- SUBSTR extracts a portion of a value by starting at a specified location.
ID
. By contrast, the SCAN function is best used when- you know the order of the words in the character value
- the starting position of the words varies
- the words are marked by some delimiter.
General form, SCAN function:
whereSCAN(argument,n,<delimiters>)
- argument specifies the character variable or expression to scan.
- n specifies which word to read.
- delimiters are special characters that must be enclosed in single quotation marks
(' ') . If you do not specify delimiters, default delimiters are used.
whereSUBSTR(argument,position,<n>)
- argument specifies the character variable or expression to scan.
- position is the character position to start from.
- n specifies the number of characters to extract. If n is omitted, all remaining characters are included in the substring.
good info, very clear thank you so much
ReplyDeleteThank you ! Even better then the SAS documentation !
ReplyDelete