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

The Programming Expert

Solving All of Your Programming Headaches

  • Home
  • Learn to Code
    • Python
    • JavaScript
  • Code Snippets
    • 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 select when – Evaluating Character Values for Conditional Processing
  • 2.  SAS %eval() Function – Evaluate Expressions in SAS Macro
  • 3.  SAS Remove Formats from Dataset with PROC DATASETS
  • 4.  Identifying Duplicates in SAS with PROC SORT dupout Option
  • 5.  SAS Uppercase – Make String Letters Uppercase with SAS upcase function
  • 6.  How to Combine Datasets Vertically in SAS
  • 7.  SAS If Then Statements with Multiple Variables
  • 8.  SAS Power Function – Exponentiate Numbers with ** in a Data Step
  • 9.  SAS floor – Round Down to Floor of Number in a SAS Data Step
  • 10.  nodup vs nodupkey PROC SORT Options in SAS

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