BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10
data newlib.c;
x='ABCDefghiJKLMNopqrs';
run;

data newlib.cw;
set newlib.c;
if count(x,lowcase(x)) then output;
run;
6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

What is the question here?

Shmuel
Garnet | Level 18

Next code distinguish between upcase and lowcase letters.

Use the same method for counting:

data want;
   x='ABCDefghiJKLMNopqrs';
   do i =1 to length(x);
        char = substr(x,i,1);
        if char = upcase(char) then put CHAR ' is an upcase letter';
                               else put CHAR ' is a lowcase letter';
  end;
run;

 

yabwon
Onyx | Level 15

Do you need something like this:

data _null_;
x='ABC123ef';
    /* k..() functions work with utf-8 */
l = klength(kcompress(x,,"kl"));
u = klength(kcompress(x,,"ku"));
put _all_;
run;

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



BrahmanandaRao
Lapis Lazuli | Level 10
I want count of lowcase and upcase in a string
andreas_lds
Jade | Level 19

@BrahmanandaRao wrote:
I want count of lowcase and upcase in a string

Well, have you tried the suggested solution? If you have requirements for the output, show them. We can't read your mind 😉

yabwon
Onyx | Level 15

In my code the variable L contains count of lower case letters, and the variable U contains count of upper case letters.

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 6 replies
  • 1128 views
  • 1 like
  • 5 in conversation