BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I'am new to sas. I have a datasets in wich the names of the variables are mix case (upper and lowercase). Because i have more than 300 variables I'am tring to capitalize them without the use of the list of all the names ( as would be the case in the RENAME function). Is there any alternate way i can do so ?

thanks for your help
4 REPLIES 4
deleted_user
Not applicable
Are you capitalizing for the sake of capitalizing (or uncapitalizing), or do you need a single-case list of variable names for another purpose?

SAS variable name usage is not case-sensitive, so it functionally does not matter what case they're in. If you need it for another purpose, however, here's something...

Let's say your dataset is called "stuff."

proc contents data = stuff out = stuffout;
run;

data stuffout;
set stuff;
vari = upcase(name);
keep vari;
run;

In the end, "stuffout" contains one variable, vari, which holds a list of variable names in all uppercase.
deleted_user
Not applicable
Thanks for your answer Elayne,

I know that case does not matter because sas is not case sensitive. But I still want to capitalize the variable names (not to get a single-case list of variable names as you are suggesting). I will export this data set later to another software and it is important to have the variable names capitalized.

thank you for your help
Cynthia_sas
SAS Super FREQ
Rufin:
If you want to "officially" capitalize the names of the variables in the descriptor portion of the SAS dataset prior to exporting the file for use with another product, you need to check out PROC DATASETS documentation, especially the MODIFY and the RENAME statements. You could use the list from Elayne's suggestion as input to your PROC DATASETS step. Your best bet might be to contact SAS Tech Support, as this is not really an ODS question, but a SAS programming and usage question.
cynthia
Tammboy
Calcite | Level 5

There is a SAS option for this:

 

option validvarname=upcase;

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 6011 views
  • 0 likes
  • 3 in conversation