Changing the Case of All Character Variables in a Data Set

Published on:
written bySubhro
SAS PROGRAMS, Tips & Tricks

This program will change the case for all of the character variables in a SAS data set. The key here is using the  _CHARACTER_ keyword in the ARRAY statement. This will create an array of all the character variables in the dataset.

Once the array is created, you can apply any character functions on all of the character variables.

data cars;
	array Chars[*] _character_;

	do i=1 to dim(Chars);
	drop i;

title "Listing the First 10 Observations in the Cars dataset";
proc print data=cars(obs=10 keep=_character_) noobs;


Changing the Case of All Character Variables in a Data Set

Every week we'll send you SAS tips and in-depth tutorials


Subhro Kar is an Analyst with over five years of experience. As a programmer specializing in SAS (Statistical Analysis System), Subhro also offers tutorials and guides on how to approach the coding language. His website, 9to5sas, offers students and new programmers useful easy-to-grasp resources to help them understand the fundamentals of SAS. Through this website, he shares his passion for programming while giving back to up-and-coming programmers in the field. Subhro’s mission is to offer quality tips, tricks, and lessons that give SAS beginners the skills they need to succeed.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap