• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Programming Expert

Solving All of Your Programming Headaches

  • HTML
  • JavaScript
  • jQuery
  • PHP
  • Python
  • SAS
  • Ruby
  • About
You are here: Home / SAS / SAS Lowercase – Make String Lowercase with SAS lowcase function

SAS Lowercase – Make String Lowercase with SAS lowcase function

January 24, 2022 Leave a Comment

To make a string variable’s letters all lowercase in a SAS data step, we can use the SAS lowcase() function.

data data_new;
        set data;
        lowercase_word = lowcase(word);
run;

When working with strings in our datasets, it can be useful for comparison or display purposes to convert strings to have all uppercase or lowercase letters.

In a SAS data step, we can use the SAS lowcase() function to easily convert a string variable to have all lowercase letters.

Let’s we have the following SAS dataset.

data data;
    input word $ 10.;
    datalines;
This
Is
A
Dataset
With
Some
Strings.
;
run;

We can easily make all of these strings lowercase with the SAS lowcase() function.

data data_new;
        set data;
        lowercase_word = lowcase(word);
run;

/* Output: */
  word     lowercase_word
1 This     this	
2 Is       is	
3 A        a	
4 Dataset  dataset	
5 With     with	
6 Some     some	
7 Strings. strings.

If you’d like to send all letters to uppercase, you can use the SAS upcase() function. If you want to capitalize the first letter of the string variable and have all other letters lowercase, you can use the SAS propcase() function.

Hopefully this article has been useful for you to learn how to use the SAS lowcase() function to convert strings to lowercase in a SAS data step.

Other Articles You'll Also Like:

  • 1.  SAS month function – Get Month from Date Variable
  • 2.  yyyy-mm-dd Date Format in SAS
  • 3.  mod Function in SAS – Find Remainder of 2 Numbers After Division
  • 4.  Using SAS to Find Mean by Group with PROC MEANS
  • 5.  SAS Not Equal – Check if a Variable is Not Equal to Another in Data Step
  • 6.  Get the Row Number in a SAS Data Step with _n_
  • 7.  =">SAS Greater Than or Equal to with GE or >=
  • 8.  SAS Dollar Format – Formatting Numbers as Dollars in SAS Dataset
  • 9.  Multiple Condition If Statements in SAS Macro Language
  • 10.  SAS include – Execute Code from Other Files in SAS with %include

About The Programming Expert

The Programming Expert is a compilation of a programmer’s findings in the world of software development, website creation, and automation of processes.

Programming allows us to create amazing applications which make our work more efficient, repeatable and accurate.

At the end of the day, we want to be able to just push a button and let the code do it’s magic.

You can read more about us on our about page.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About The Programming Expert

the programming expert main image

Welcome to The Programming Expert. We are a group of US-based programming professionals who have helped companies build, maintain, and improve everything from simple websites to large-scale projects.

We built The Programming Expert to help you solve your programming problems with useful coding methods and functions in various programming languages.

Search

Learn Coding from Experts on Udemy

Looking to boost your skills and learn how to become a programming expert?

Check out the links below to view Udemy courses for learning to program in the following languages:

Copyright © 2023 · The Programming Expert · About · Privacy Policy