SAS Programming

DATA Step, Macro, Functions and more
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 1396 views
  • 1 like
  • 5 in conversation