Language Reference

Character and Formatting Functions

ANYALNUM searches a character string for an alphanumeric character and returns the first position at which it is found
ANYALPHA searches a character string for an alphabetic character and returns the first position at which it is found
ANYCNTRL searches a character string for a control character and returns the first position at which it is found
ANYDIGIT searches a character string for a digit and returns the first position at which it is found
ANYFIRST searches a character string for a character that is valid as the first character in a SAS variable name under VALIDVARNAME=V7, and returns the first position at which that character is found
ANYGRAPH searches a character string for a graphical character and returns the first position at which it is found
ANYLOWER searches a character string for a lowercase letter and returns the first position at which it is found
ANYNAME searches a character string for a character that is valid in a SAS variable name under VALIDVARNAME=V7, and returns the first position at which that character is found
ANYPRINT searches a character string for a printable character and returns the first position at which it is found
ANYPUNCT searches a character string for a punctuation character and returns the first position at which it is found
ANYSPACE searches a character string for a white-space character (blank, horizontal and vertical tab, carriage return, line feed, form feed) and returns the first position at which it is found
ANYUPPER searches a character string for an uppercase letter and returns the first position at which it is found
ANYXDIGIT searches a character string for a hexadecimal character that represents a digit and returns the first position at which that character is found
BYTE returns one character in the ASCII or EBCDIC collating sequence
CAT concatenates character strings without removing leading or trailing blanks
CATQ concatenates character or numeric values by using a delimiter to separate items and by adding quotation marks to strings that contain the delimiter
CATS concatenates character strings and removes leading and trailing blanks
CALL CATS concatenates character strings and removes leading and trailing blanks
CATT concatenates character strings and removes trailing blanks
CALL CATT concatenates character strings and removes trailing blanks
CATX concatenates character strings, removes leading and trailing blanks, and inserts separators
CALL CATX concatenates character strings, removes leading and trailing blanks, and inserts separators
CHOOSEC returns a character value that represents the results of choosing from a list of arguments
CHOOSEN returns a numeric value that represents the results of choosing from a list of arguments
COLLATE returns an ASCII or EBCDIC collating sequence character string
COMPARE returns the position of the left-most character by which two strings differ, or returns 0 if there is no difference
COMPBL removes multiple blanks from a character string
CALL COMPCOST sets the costs of operations for later use by the COMPGED function
COMPGED compares two strings by computing the generalized edit distance
COMPLEV compares two strings by computing the Levenshtein edit distance
COMPRESS removes specific characters from a character string
COUNT counts the number of times that a specific substring of characters appears within a character string that you specify
COUNTC counts the number of specific characters that either appear or do not appear within a character string that you specify
COUNTW counts the number of words in a character expression
FIND searches for a specific substring of characters within a character string that you specify
FINDC searches for specific characters that either appear or do not appear within a character string that you specify
FINDW returns the character position of a word in a string, or returns the number of the word in a string
FIRST returns the first character in a character string
FMTINFO retrieves information about a format or informat
IFC returns a character value that matches an expression
IFN returns a numeric value that matches an expression
INDEX searches a character expression for a string of characters
INDEXC searches a character expression for specific characters
INDEXW searches a character expression for a specified string as a word
INPUTC applies a character informat at run time
INPUTN applies a numeric informat at run time
LEFT left aligns a character expression
LENGTH returns the length of a character string
LENGTHC returns the length of a character string, including trailing blanks
LENGTHM returns the amount of memory (in bytes) that is allocated for a character string
LENGTHN returns the length of a nonblank character string, excluding trailing blanks, and returns 0 for a blank character string
LOWCASE converts all letters in an argument to lowercase
CALL MISSING assigns a missing value to the specified character or numeric variable
NLITERAL converts a character string that you specify to a SAS name literal (N-literal)
NOTALNUM searches a character string for a nonalphanumeric character and returns the first position at which it is found
NOTALPHA searches a character string for a nonalphabetic character and returns the first position at which it is found
NOTCNTRL searches a character string for a character that is not a control character and returns the first position at which it is found
NOTDIGIT searches a character string for any character that is not a digit and returns the first position at which that character is found
NOTFIRST searches a character string for an invalid first character in a SAS variable name under VALIDVARNAME=V7, and returns the first position at which that character is found
NOTGRAPH searches a character string for a nongraphical character and returns the first position at which it is found
NOTLOWER searches a character string for a character that is not a lowercase letter and returns the first position at which that character is found
NOTNAME searches a character string for an invalid character in a SAS variable name under VALIDVARNAME=V7, and returns the first position at which that character is found
NOTPRINT searches a character string for a nonprintable character and returns the first position at which it is found
NOTPUNCT searches a character string for a character that is not a punctuation character and returns the first position at which it is found
NOTSPACE searches a character string for a character that is not a white-space character (blank, horizontal and vertical tab, carriage return, line feed, form feed) and returns the first position at which it is found
NOTUPPER searches a character string for a character that is not an uppercase letter and returns the first position at which that character is found
NOTXDIGIT searches a character string for a character that is not a hexadecimal digit and returns the first position at which that character is found
NVALID checks a character string for validity for use as a SAS variable name in a SAS statement
PROPCASE converts all words in an argument to proper case
PUTC applies a character format at run time
PUTN applies a numeric format at run time
REPEAT repeats a character expression
REVERSE reverses a character expression
RIGHT right aligns a character expression
SCAN selects a given word from a character expression
CALL SCAN returns the position and length of a given word from a character expression
ROUNDEX encodes a string to facilitate searching
SPEDIS determines the likelihood of two words matching, expressed as the asymmetric spelling distance between the two words
STRIP returns a character string with all leading and trailing blanks removed
SUBPAD returns a substring that has specified length and is padded with blanks, if necessary
SUBSTRN returns a substring, allowing a result with a length of zero
SUBSTR extracts substrings of character expressions
TRANSLATE replaces specific characters in a character expression
TRANSTRN replaces or removes all occurrences of a substring in a character string
TRANWRD replaces or removes all occurrences of a word in a character string
TRIM removes trailing blanks from character expressions and returns one blank if the expression is missing
TRIMN removes trailing blanks from character expressions and returns a null string (zero blanks) if the expression is missing
UPCASE converts all letters in an argument to uppercase
UUIDGEN returns the short or binary form of a Universal Unique Identifier (UUID)
VERIFY returns the position of the first character that is unique to an
expression
WHICHC searches for a character value that is equal to the first argument, and returns the index of the first matching value
WHICHN searches for a numeric value that is equal to the first argument, and returns the index of the first matching value

Last updated: July 20, 2026