NOTUPPER AND NOTLOWER
Function: NOTLOWER
Purpose: To determine the position of the first character in a string that is not a lowercase letter. If none is found, the function returns a 0.
With the use of an optional parameter, this function can begin searching at any position in the string and can also search from right to left, if desired.
Syntax: NOTLOWER(character-value <,start>)
character-value Is any SAS character value.
Start is an optional parameter that specifies the position in the string to begin search. If it is omitted,the search starts at the beginning of the string. If it is non-zero, the search begins at the position in the string of the absolute value of the number (starting from the left position in the string). If the start value is positive, the search goes from left to right; if the string is negative, the search goes from right to left, starting at the end of the string. If the value of start is a positive number longer that the length of the sting, or it is 0 , the function returns a 0.
Example:
For these examples, STRING = "abc 123 ?XYZ_n_"
Output
Functions Returns
NOTLOWER("ABCDabcd") 1 (position of "A")
NOTLOWER("abcdefg") 0 (all lowercase characters)
NOTLOWER(STRING) 4 (position of blank)
NOTLOWER("??$$%%") 1 (position of "?")
NOTLOWER(STRING,5) 5 (position of "1")
NOTLOWER(STRING,-6) 6 (position of "2")
NOTLOWER(STRING,6) 6 (position of "2")
NOTLOWER("abcdefg") 0 (all lowercase characters)
NOTLOWER(STRING) 4 (position of blank)
NOTLOWER("??$$%%") 1 (position of "?")
NOTLOWER(STRING,5) 5 (position of "1")
NOTLOWER(STRING,-6) 6 (position of "2")
NOTLOWER(STRING,6) 6 (position of "2")
Function: NOTUPPER
Purpose: To determine the position of the first character in a string that is not an uppercase letter. If none is found, the function returns a 0.
With the use of an optional parameter, this function can begin searching at any position in the string and can also search from right to left, if desired.
Syntax: NOTUPPER(character-value <,start>)
character-value Is any SAS character value.
Start is an optional parameter that specifies the position in the string to begin search. If it is omitted,the search starts at the beginning of the string. If it is non-zero, the search begins at the position in the string of the absolute value of the number (starting from the left position in the string). If the start value is positive, the search goes from left to right; if the string is negative, the search goes from right to left, starting at the end of the string. If the value of start is a positive number longer that the length of the sting, or it is 0 , the function returns a 0.
Example:
For these examples, STRING = "ABC 123 ?XYZ_n_"
Output
Functions Returns
NOTUPPER("ABCDabcd") 5 (position of "A")
NOTUPPER("abcdefg") 0 (all lowercase characters)
NOTUPPER(STRING) 4 (position of first blank)
NOTUPPER("??$$%%") 1 (position of "?")
NOTUPPER(STRING,5) 5 (position of "1")
NOTUPPER(STRING,-6) 6 (position of "2")
NOTUPPER(STRING,6) 6 (position of "2")
NOTUPPER(STRING) 4 (position of first blank)
NOTUPPER("??$$%%") 1 (position of "?")
NOTUPPER(STRING,5) 5 (position of "1")
NOTUPPER(STRING,-6) 6 (position of "2")
NOTUPPER(STRING,6) 6 (position of "2")
NOTE:
As with most character fuctions, be careful with the trailing blanks, this is the reason we obtain 4th postion.
Comments
Post a Comment