*Copyright @ www.statschoice.com;


/********************************************************************************

Function definition

********************************************************************************/

/********************************************************************************

********************************************************************************/

/********************************************************************************

Where can a SAS function can be used?

********************************************************************************/

/********************************************************************************

  1. in data step programming
  2. in a WHERE expression (where statement or where clause)
  3. in proc sql

********************************************************************************/

/********************************************************************************

What is a character function?

********************************************************************************/

/********************************************************************************

********************************************************************************/

/********************************************************************************

Character functions that converts the case of characters

********************************************************************************/



/********************************************************************************

Function Defintion
UPCASE Upcase function is used for converting english alphabet letters of a variable's value to uppercase
LOWCASE Lowcase function is used for convering englight alphabet letters of a variable's value to lowercase
PROPCASE Propcase function is used for converting all words of a variable's value to proper case.
That is, propcase function converts the first letter of each 'word' to uppercase (and other letters of the word to lowercase). By default these characters are considered word separators: blank, forward slash, hyphen, open parenthesis, period

********************************************************************************/

/********************************************************************************

Create sample data

********************************************************************************/

/********************************************************************************

Create 3 new variables named upper, lower and proper by appying upcase, lowcase and propcase functions respectively on sring variable

********************************************************************************/

/********************************************************************************

********************************************************************************/






/********************************************************************************

Character Functions that return the length of the strings

********************************************************************************/



/********************************************************************************

Function Definition
LENGTH Length function is used for obtaining the number of characters in a character string excluding trailing blanks, retruns a value of 1 for a blank value
LENGTHN LengthN function is used for obtaining the number of characters in a character string excluding trailing blanks, retruns 0 for blank value

********************************************************************************/

/********************************************************************************

Create sample data

********************************************************************************/

/********************************************************************************

Create two new variables length and lengthn by obtaining the length of string variable using LENGTH and LENGTHN functions

********************************************************************************/

/********************************************************************************

********************************************************************************/