SAS Character Functions quick revision for Interview

 

  • use a LENGTH statement to set the desired length of a character variable
  • use the concatenation operator (| |) to join two or more character strings
  • use the COMPBL function to convert multiple blanks in a character string to a single blank
  • use the COMPRESS function to remove characters from a string
  • use the VERIFY function to check that certain values are present in a character variable
  • use the TRIM function to remove the trailing blanks from a character string
  • use the SUBSTR function to select a subset of consecutive characters from a larger string
  • use the SUBSTR function on the left-hand side of an equal sign
  • use the SUBSTR function to unpack a string of characters into its individual characters
  • use the INPUT function to convert a character variable to a numeric variable
  • use the PUT function to convert a numeric variable to a character variable
  • use the SCAN function to parse a string and/or extract part of a string
  • use the INDEX and INDEXC functions to locate a position of one string within another string
  • use the UPCASE function to change lowercase letters to uppercase letters, and use the LOWCASE function to change uppercase letters to lowercase letters
  • use the PROPCASE function to capitalize the first letter of each word
  • use the TRANWRD function to translate a word
  • use the CATS function to strip leading and trailing blanks before joining two or more strings
  • use the CATX function to strip leading and trailing blanks, and then join two or more strings with a specified character inserted between the strings
  • use the LENGTHC function to return the storage length of a character variable
  • use the LENGTH and/or LENGTHN functions to determine the length of a character variable not counting trailing blanks
  • use the COUNT function to count the number of times a particular substring appears in a string
  • use the COUNTC function to count the number of times one or more characters appear in a string

1 thought on “SAS Character Functions quick revision for Interview

Leave a Comment

2 × two =