BookmarkSubscribeRSS Feed
BLT2023
Calcite | Level 5

Hello,

 

In the code below, I am looking to make the 'adult_pop' variable name capital (ADULT_POP) and make the observations that are within the COUNTY variable proper case. I have tried everything I can think of, so I'm looking for a fresh and more experienced set of eyes. Thanks for any insight! 

 

DATA WORK.Illus;
   MERGE CoImpt.PhysicalActivity CoImpt.Geo_Reference_Table;
   KEEP FIPS COUNTY TRACT_NAME adult_pop;
   
   RUN;
3 REPLIES 3
Kurt_Bremser
Super User

SAS is case insensitive with regards to names of datasets, variables and other objects, so the casing is irrelevant.

Dataset names are kept internally as all uppercase, while the physical filenames are all lowercase.

Only variable names are kept in the casing they were entered.

If you want something special, put it in a label.

 

You might try if a RENAME works:

data work.illus;
merge
  coImpt.physicalactivity
  coImpt.geo_reference_table
;
keep FIPS COUNTY TRACT_NAME adult_pop;
rename adult_pop=ADULT_POP;
run;
Astounding
PROC Star
A two step fix:

First, change the order of the statements. Move the KEEP statement to before the MERGE statement.

Second, change the spelling to all caps in the KEEP statement.

As Kurt mentioned, the first mention of the variable determines the default (unlabeled) spelling used in reporting.
PaigeMiller
Diamond | Level 26

@BLT2023 wrote:

 

In the code below, I am looking to make the 'adult_pop' variable name capital (ADULT_POP) and make the observations that are within the COUNTY variable proper case. I have tried everything I can think of, so I'm looking for a fresh and more experienced set of eyes.


Why? Is it because you want upper case headings in a report or table that you will make use of? As always context is everything, we can offer better solutions if we knew WHY you are doing something.

 

So yes, you can force SAS to make the variable name upper case, as explained by @Kurt_Bremser and @Astounding, but it simply isn't necessary, its extra work with little benefit, IMHO. Just because you can do something doesn't mean you should do that thing. Better, you might want to assign a label to the variable, in which case you can then make the label whatever case you want, and make it more readable, so instead of ADULT_POP, do your audience a favor and use actual English (not computerese) labels, such as the label "Adult Population" (or similar). In reporting procedures such as PROC PRINT, PROC TABULATE and PROC REPORT, the labels (in real English, not computerese) will be used and your audience will be grateful.

--
Paige Miller

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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