Is there a funtion to captalize the first letter and terminology, the prepositionis and articles are in lower case?
example:
var='aids is one of the sexually transmitted diseases'
a funtion is called wordcase to adjust the letter capitallization automatically.
wordcase(var)='AIDS is one of the Sexually Transmitted Diseases'
The closest SAS function is function propcase.
To post-process a string to your needs, you can do something like this:
data T;
V1='aids is one of the sexually transmitted diseases'
V2=propcase(V1);
V2=prxchange('s/\b(AIDS|NATO|POTUS)\b/\U\1\E/i' , -1, V2);
V2=prxchange('s/\b(is|are|one|of|with|the|at)\b/\L\1\E/i', -1, V2);
run;
V2=AIDS is one of the Sexually Transmitted Diseases
The closest SAS function is function propcase.
To post-process a string to your needs, you can do something like this:
data T;
V1='aids is one of the sexually transmitted diseases'
V2=propcase(V1);
V2=prxchange('s/\b(AIDS|NATO|POTUS)\b/\U\1\E/i' , -1, V2);
V2=prxchange('s/\b(is|are|one|of|with|the|at)\b/\L\1\E/i', -1, V2);
run;
V2=AIDS is one of the Sexually Transmitted Diseases
hi @ChrisNZ , thanks.
the array, and some functions, and regEx functions can solve the letter capitallization, hope a new function can do it directly in the future.
> hope a new function can do it directly in the future.
That won't happen. Every user has a different set of words and logic to process in a specific manner.
You will need a computer that speaks English. After all, how do you treat:
Pfizer transmitted its data about ABC, a new drug that aids in treatment of AIDS, a Sexually Transmitted Disease
One "aids", one "AIDS", one "transmitted", one "Transmitted"
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.