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
data have;
input geo $50.;
datalines;
LESTER B. PEARSON
VAL-DOR
NORTH BAY
;
run;
data want;
set have;
geo2 = propcase(geo);
run;
data have;
input geo $50.;
datalines;
LESTER B. PEARSON
VAL-DOR
NORTH BAY
;
run;
data want;
set have;
geo2 = propcase(geo);
run;
thanks!
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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.