Convert to upper UPCASE(), lower LOWCASE() and proper case PROPCASE() in SAS

Convert to column to Upper case in SAS is accomplished using UPCASE() function, Converting a column to Lower case in SAS is done using LOWCASE() function, and title case in SAS uses PROPCASE() function. Let’s see an example of each.

  • Convert column to upper case in SAS – UPCASE() function
  • Convert column to lower case in SAS – LOWCASE() function
  • Convert column to title case in SAS – PROPCASE() function

 

So we will be using EMP_DET Table in our example

Convert to upper lower and proper case in SAS 1

 

 

Convert to Upper Case in SAS – UPCASE() Function

Syntax:

 UPCASE(‘colname1’)

colname1 – Column name

UPCASE() Function in SAS takes up the column name as argument and converts the column to upper case

/* Convert to upper case */ 

data EMP_DET1; 
set EMP_DET; 
STATE_CASE = UPCASE(state_name); 
run;

So the resultant table with upper case converted column will be,

Convert to upper lower and proper case in SAS 2

 

Convert to Lower Case in SAS – LOWCASE() Function

Syntax:

 LOWCASE(‘colname1’)

colname1 – Column name

LOWCASE() Function in SAS takes up the column name as argument and converts the column to Lower case


/* Convert to lower case */ 

data EMP_DET1; 
set EMP_DET; 
STATE_CASE = LOWCASE(state_name); 
run; 

So the resultant table with lower case converted column will be,

Convert to upper lower and proper case in SAS 3

 

 

Convert to Title case or Proper case in SAS – PROPCASE Function

Syntax:

 PROPCASE(‘colname1’)

colname1 – Column name

PROPCASE() Function in SAS takes up the column name as argument and converts the column to proper case i.e. only First character of the word will be in upper case all others will be in lower case


/* Convert to proper case/ title case */ 

data EMP_DET1; 
set EMP_DET; 
STATE_CASE = PROPCASE(state_name); 
run;

So the resultant table with proper case converted column will be,

Convert to upper lower and proper case in SAS 4

 

                                                                                             

Author

  • Sridhar Venkatachalam

    With close to 10 years on Experience in data science and machine learning Have extensively worked on programming languages like R, Python (Pandas), SAS, Pyspark.

    View all posts