• 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 Uppercase – Make String Letters Uppercase with SAS upcase function

SAS Uppercase – Make String Letters Uppercase with SAS upcase function

January 24, 2022 Leave a Comment

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

data data_new;
        set data;
        uppercase_word = upcase(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 upcase() function to easily convert a string variable to have all uppercase 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 uppercase with the SAS upcase() function.

data data_new;
        set data;
        uppercase_word = upcase(word);
run;

/* Output: */
  word     uppercase_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 lowercase, you can use the SAS lowcase() 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 upcase() function to convert strings to uppercase in a SAS data step.

Other Articles You'll Also Like:

  • 1.  SAS prxmatch – Find Pattern in String Using Regex (Regular Expression)
  • 2.  SAS sum() Function – Find Sum Across Columns in Data Step
  • 3.  SAS rename Statement – How to Rename Variables in a Data Step
  • 4.  SAS Not In – How to Check if Variable is Not in List of Values
  • 5.  Using SAS to Sum by Group with PROC MEANS
  • 6.  SAS nodupkey – How to Remove Duplicates with PROC SORT by Key
  • 7.  Get the Row Number in a SAS Data Step with _n_
  • 8.  =">SAS Greater Than or Equal to with GE or >=
  • 9.  SAS Power Function – Exponentiate Numbers with ** in a Data Step
  • 10.  SAS round – Rounding Numbers in a SAS Data Step

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