Sentry Page Protection
SAS Functions [12-14]
UPCASE, LOWCASE & PROPCASE
The UPCASE, LOWCASE and PROPCASE functions are quite straightforward.
You can use them to convert character values into your desired case.
- UPCASE: Convert to all upper case
- LOWCASE: Convert to all lower case
- PROPCASE: Convert to proper case (first letter of each word in uppercase and the rest of the letters in lowercase)
Let's take a look at the EXAMPLE data set below:
[Reminder: To see the EXAMPLE data set on SAS Studio, run the code in the yellow box above]
Let's apply the UPCASE, LOWCASE and PROPCASE functions to the sentence above.
Example
Data Example2;
Set Example;
Up = Upcase(Comment);
Low = Lowcase(Comment);
Prop = Propcase(Comment);
Run;
Exercise
Copy and run the code from the yellow box below.
The SYMPTOMS data set contains 2 variables:
- Sickness: Type of sickness
- Symptoms: The symptoms from each sickness
Write a SAS program to find out which sickness(s) causes fatigue as a symptom.
Please note that the symptoms are not reported in a standardized case.
Need some help?
HINT:
You can identify the symptoms by using the INDEX function. You must make sure the symptom can be found regardless of the case it is captured.
SOLUTION:
Data Symptoms2;
Set Symptoms;
Up = Upcase(Symptoms);
Ind = Index(Up, "FATIGUE");
Run;
Fatigue is identified as a symptom if the IND variable returns a non-zero value (e.g. 23, 1).
Fill out my online form.