Hi,
Can you think of any case where the i modifier would give a different result from the u modifier?
- i ignores case
- u adds uppercase letters to the list of characters
Just an example with countc, but it could be with any function allowing these modifiers.
data test;
length x $12;
x='bca1-abcABC2';
countc_x_abc_i=countc(x,'abc','i');
countc_x_abc_u=countc(x,'abc','u');
run;
proc print data=test;
run;
Hi @xxformat_com,
Example 1:
x='bca1-abcABD2';
Then your COUNTC calls would yield 8 vs. 9 because the second counts the "D" (all uppercase letters were added to the initial list consisting of "a", "b" and "c"), whereas the first does not (only "a", "b", "c", "A", "B" and "C").
Example 2:
Leave x unchanged, but change the second argument of the COUNTC calls to 'abd'. Then you get 6 vs. 7 for similar reasons.
data test;
length x $12;
x='bca1-abcABC2';
countc_x_abc_i=compress(x,'a','i');
countc_x_abc_u=compress(x,'a','u');
run;
proc print data=test;
run;
Hi @xxformat_com,
Example 1:
x='bca1-abcABD2';
Then your COUNTC calls would yield 8 vs. 9 because the second counts the "D" (all uppercase letters were added to the initial list consisting of "a", "b" and "c"), whereas the first does not (only "a", "b", "c", "A", "B" and "C").
Example 2:
Leave x unchanged, but change the second argument of the COUNTC calls to 'abd'. Then you get 6 vs. 7 for similar reasons.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.