BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BCNAV
Quartz | Level 8

I have a variable called NAME

 

In it are geographical locations all in CAPS

 

Example:

 

LESTER B. PEARSON

VAL-DOR

NORTH BAY

 

Is there a SAS format for text that will convert these to:

 

Lester B. Pearson

Val-Dor

North Bay

 

thanks

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
maguiremq
SAS Super FREQ
data have;
input geo $50.;
datalines;
LESTER B. PEARSON
VAL-DOR
NORTH BAY
;
run;

data want;
set have;
geo2 = propcase(geo);
run;

View solution in original post

3 REPLIES 3
maguiremq
SAS Super FREQ
data have;
input geo $50.;
datalines;
LESTER B. PEARSON
VAL-DOR
NORTH BAY
;
run;

data want;
set have;
geo2 = propcase(geo);
run;
BCNAV
Quartz | Level 8

thanks!

FreelanceReinh
Jade | Level 19

You can use the PROPCASE function proposed by @maguiremq to create such a format:

proc format;
value $propcase (default=200)
other=[propcase()];
run;

data have;
input name $60.;
cards;
LESTER B. PEARSON
VAL-DOR
NORTH BAY
;

proc print data=have;
format name $propcase.;
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1193 views
  • 5 likes
  • 3 in conversation